In: Statistics and Probability
How many numbers between 1 and 500 (including 1 and 500) are not divisible by any of 3, 5, or 7? Your solution should be worked all the way out into an integer.
Let A, B and C be the set of numbers between 1 and 500 that are divisible by 3, 5 and 7 respectively.
n(A) = [500/3] = 166
n(B) = [500/5]= 100
n(C) = [500/7] = 71
Simply adding up all these numbers would not help us form our solution. Notice that numbers which are multiples of LCM of 3 and 5 are counted twice. So are multiples of LCM of 3 and 7, and 5 and 7. Multiples of LCM of 3, 5 and 7 are counted thrice!
We need to make sure that each number is counted exactly once. The cardinality of union of sets A, B and C yields precisely that!
n(A ∩ B) = [500/15] = 33
n(B ∩ C) = [500/35] = 14
n(A ∩ C) = [500/21] = 23
n(A ∩ B ∩ C) = [500/105] = 4
= 271
So, there are 271 numbers between 1 and 500 that are divisible by either 3 or, 5 or, 7.
There are numbers between 1 and 500 (including 1 and 500) are not divisible by any of 3, 5, or 7 is
(500-271) = 229.
*****If you have any queries or doubts please comment below, if you're satisfied please give a like. Thank you!