Not divisible by $2,3$ or $5$ but divisible by $7$

You can solve this with inclusion-exclusion. First look for how many numbers are divisible by $7$: that's $\lfloor 2000/7 \rfloor = 285$, the integer part of $2000/7$.

Now exclude those that are divisible by $2$ (multiples of $14$; there are $\lfloor 2000/14 \rfloor$), divisible by $3$ ($\lfloor 2000/21 \rfloor$) and divisible by $5$ ($\lfloor 2000/35 \rfloor$).

This is excluding too many. Add back those that you removed twice or more: $\lfloor 2000/42 \rfloor + \lfloor 2000/70 \rfloor + \lfloor 2000/105 \rfloor$.

Finally, exclude again those that are divisible by all of $2,3,$ and $5$: these are multiples of $2\cdot 3 \cdot 5 \cdot 7 = 210$ and there are $\lfloor 2000/210 \rfloor$ such.


A-> divisible by $2$

B -> divisible by $3$

C -> Divisible by $5$

$|A|=|2000/2|= 1000; |B| = |2000/3|= 666; |c| = |2000/5| = 400$

$$n(A \cup B \cup C) = N(A) + N(B) + N(C) - N(A\cap B) - N(A\cap C) - N(B\cap C) + N(A\cap B\cap C)\\ |A\cup B \cup C| = 1000 + 666 + 400 – 333 – 133 – 200 + 66 = 1466$$

No of integers Not Divisible by $2,3$ or $5 = 2000 – 1466 = 534$

Therefore No of integers divisible by $7 = |534/7| = 76$


Hint: Given any number $n$ not divisible by $2,3,5$, we get that $7n$ is divisible by $7$ and not divisible by $2,3,5.$ And visa versa.


\begin{align}\# \text{ of numbers divisible by }7\text{ but not by }2,3 \text{ or }5 & = \#\text{ of numbers divisible by }7\\ & - \#\text{ of numbers divisible by 7 and 2, i.e., by 14}\\ & - \#\text{ of numbers divisible by 7 and 3, i.e., by 21}\\ & - \#\text{ of numbers divisible by 7 and 5, i.e., by 35}\\ & + \#\text{ of numbers divisible by 7 and 2 and 3, i.e., by 42}\\ & + \#\text{ of numbers divisible by 7 and 2 and 5, i.e., by 70}\\ & + \#\text{ of numbers divisible by 7 and 3 and 5, i.e., by 105}\\ & - \#\text{ of numbers divisible by 7 and 2 and 3 and 5, i.e., by 210} \end{align}