How many integers in $\{500,...,1000\}$ are not divisible by 3, 7 or 13?

291 Views Asked by At

I am wondering what the best way to approach this question is. I thought that I would calculate the number of integers that aren't divisible by 3, 7 or 13 in $\{1,2,...,1000\}$ as well as the number of integers that aren't divisible by 3, 7 or 13 in $\{1,2,...,500\}$ using the inclusion-exclusion principle. Then I would subtract on from the other to get the desired solution. Is this the right approach or is there a better way of doing this?

1

There are 1 best solutions below

0
On

As JMoravitz noted in a comment, this is the right approach, except for a minor mistake. Since $3\cdot7\cdot13=273$ is quite close to $250$, which divides $500$ and $1000$, another option would be to note that $(3-1)(7-1)(13-1)=144$ numbers out of each consecutive stretch of $273$ numbers aren't divisible by $3$, $7$ or $13$, apply this to $\{1,\ldots,2\cdot273\}$ and $\{1,\ldots,4\cdot273\}$ and deal with the excess counts in an ad-hoc manner; but that would probably be more effort and more error-prone than the inclusion-exclusion calculation.