Let's start with how many numbers from 1 - 21,000 are divisible by 2? That wouuld be half of them, all the even numbers so 10,500
Then how many are divisible by 3. Well 21,000/3 = 7000 so we have 3*1, 3*2, ... 3*7000 as options so there are 7000 multiples of 3
Similarly there are 21,000/7 = 3000 multiples of 7
So total there are 10,500 + 7000 + 3000 = 20,500
It would be easy if we could just add these together but the problem is that there is some overlap, think about a venn diagram with 3 circles, with each circle being multiples of 2,3,7 respectively.
Let's find the amount of overlap between the circles
Multiples of 2 and 3: This means multiples of 6. Since 21,000/6 = 3,500
Multiples of 2 and 7: This means multiples of 14. Since 21,000/14 = 1,500
Mulitples of 3 and 7: This means multiples of 21. Since 21,000/21 = 1,000
So these are all the values that we counted twice since each of these were included in our counts for multiples. For example the 1,000 multiples of 3 and 7 were part of both the counts. So we need to subtract each of these off to make sure we are not double counting
20,500 - 3,500 - 1,500 - 1,000 = 14, 500
But we are still not done! What about numbers that are multiples of 2,3,7. They were initially counted 3 times in our first total of 20,500.
But now they were included in each of our pairs of multiples so we have now subtracted them away 3 times. so numbers like 42 have not been counted at all, so we have to add them back in
21,000/42 = 500
So 14,500 + 500 = 15,000
I can't include an image in my answer but for a visual think about initially having a venn diagram. We color in all three circles. The regions that overlap two circles get colored twice so we take one "coloring" away so now those are just included once. But the center region where all three overlap was initially colored 3 times but then subtracted 3 times so we add it in once.