N(A or B) = N(A) + N(B) - N(A and B)
A = set of positive integers divisible by 3
B = set of positive integers divisible by 7
A and B = set of positive integers divisible by both =
= set of integers divisible by 3*7 or 21.
First we find out how many are divisible by 3.
2012÷3 = 670.6666667, so 670×3 = 2010 is the last multiple of 3
These are 3,6,9,...,2010
Dividing each of those by 3 gives {1,2,3,...,670}
So obviously there are 670 multiples of 3.
Next we find out how many are divisible by 7.
2012÷7 = 287.4285714, so 287×7 = 2009 is the last multiple of 7
These are 7,14,21,...,2009
Dividing each of those by 7 gives {1,2,3,...,287}
So obviously there are 287 multiples of 7.
Next we find out how many are divisible by 21.
2012÷21 = 95.80952381, so 95×21 = 1995 is the last multiple of 21
These are 21,42,63...,1995
Dividing each of those by 21 gives {1,2,3,...,95}
So obviously there are 95 multiples of 21.
N(A or B) = N(A) + N(B) - N(A and B)
N(A or B) = 670 + 287 - 95 = 862
So there are 862 integers from 1 to 2012 that are
either divisible by 3 or 7 or both, so there are
2012 - 862 or 1150 that are divisible by neither
3 nor 7?
Edwin