How many integers are there from 1 to 10000 that are divisible by exactly two of the numbers 4, 5, 6, and 7

combinatorics

Could someone please help me solve this question:
How many integers are there from 1 to 10000 that are divisible by exactly two of the numbers 4, 5, 6, and 7?
Thanks!! Also, I think I would have to use PIE but I can't figure out how to set it up.

Best Answer

Inclusion and exclusion is the way to do it. It's the number divisible by two of the factors, minus the number divisible by three of the factors, plus the number divisible by all four. As Matthew Daly said in a comment, you have to treat all the cases separately. For example, a number is divisible by all four factors if and only if it is divisible by their greatest common divisor, namely $420$. The number of multiples of $420$ less than or equal to $10000$ is $$\left\lfloor\frac{10000}{420}\right\rfloor=23$$

I leave the rest to you.