[Math] Find the probability that an integer selected between 1 and 5000 is divisible by at least one of 3, 5 and 7

discrete mathematicsdivisibilityprobability

I'm having a hard time finding the solution. I can find integers that are divisible by only one of them, but there are many that are divisible by two of them. That's the problem.
Find the probability that an integer selected between 1 and 5000(inclusive) is divisible by at least one of 3, 5,7, but not divisible by all of these numbers.

Best Answer

Hints:

There are a total of $\lfloor\frac{n}{k}\rfloor$ numbers divisible by $k$ in the set of numbers $\{1,2,\dots,n\}$

The principle of inclusion-exclusion states as a special case that $|A\cup B\cup C| = |A|+|B|+|C|-|A\cap B| - |A\cap C| - |B\cap C| + |A\cap B\cap C|$.

Let $A=\{\text{numbers in 1,2,...,5000 divisible by}~3\}$, $B=\{\text{numbers in 1,2,...,5000 divisible by}~5\}$, etc... then what does $A\cap B$ represent, and what does $A\cap B\cap C$ represent? How to find $|A|,|A\cap B|, |A\cap B\cap C|$?