
Sean M. answered 10/02/22
Berkeley Graduate in Math, Logic and Comp Sci
Any even number is divisble by two, so that accounts for 10,500 numbers.
One third of the numbers are divisble by 3, so that gives us 7,000 numbers. However, every number divisble by 6 is divisble by 2 and 3, so we have to subtract that many to avoid overcounting. That gives us one sixth of the numbers to subtract, which is half of one third, so we take away 3,500 from this count and add to our new total of 14,000.
The numbers divisble by 5 are those ending in 5 or 0. That is one fifth of the numbers, so that accounts for 4,250 numbers. But wait! If a number is divisble by 10 = 2 x 5, we've already accounted for it. So we subtract 2,125 of these to get 2,125 left. Of these numbers, which all end in 5, we need to get rid of the ones that are divisible by 15. 21,000/15 is 1,400, so in total we have 725 new numbers to add to the count, giving us 14,725.
Finally, we need to add the remaining numbers that are divisble by 7 but NOT divisble by 2, 3 or 5. There are 3,000 numbers between 1 and 21,000 divisible by 7. Of these 3,000 numbers half of them are even, so that gets rid of 1,500. A tenth of these numbers are divisble by 5 (since we removed all the evens) so we subtract 150 to get 1,350. Finally, we need to get rid of the numbers that are divisible by 21 that are not even or divisble by 5. There are 1,000 numbers divisible by 21, and half of them are even. Of the 500 remaining, one tenth are divisible by 5, so that's 400. So, we add the remaining 950 to our total to get our final answer of 15,675.