How many positive integers less than or equal to 1,000 are divisible by neither 3, nor 5, nor 7?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Use the Inclusion-Exclusion formula: (see https://brilliant.org/wiki/principle-of-inclusion-and-exclusion-pie/ )
Notation: let [ n ] = {integers from 1 to n}, and, for our purposes, [ k , n ] = {multiples of k less than or equal to n}
We are looking for ∣ [ 1 0 0 0 ] ∖ { [ 3 , 1 0 0 0 ] ∪ [ 5 , 1 0 0 0 ] ∪ [ 7 , 1 0 0 0 ] } ∣
Let X = [ 1 0 0 0 ] , and X t = [ t , 1 0 0 0 ] for t ∈ { 3 , 5 , 7 , 1 5 , 2 1 , 3 5 , 1 0 5 }
Let X ∗ = X ∖ ( X 3 ∪ X 5 ∪ X 7 )
Note : for p , q ∈ { 3 , 5 , 7 } , X p ∩ X q = X p q . Similarly, X 3 ∩ X 5 ∩ X 7 = X 1 0 5
By I-E, ∣ X ∗ ∣ = ∣ X ∣ − ( ∣ X 3 ∣ + ∣ X 5 ∣ + ∣ X 7 ∣ ) + ( ∣ X 1 5 ∣ + ∣ X 2 1 ∣ + ∣ X 3 5 ∣ ) − ∣ X 1 0 5 ∣
Note also ∣ X k ∣ = ⌊ ( k 1 0 0 0 ) ⌋
Thus ∣ X ∗ ∣ = 1 0 0 0 − ( 3 3 3 + 2 0 0 + 1 4 2 ) + ( 6 6 + 4 7 + 2 8 ) − 9 , i.e. ∣ X ∗ ∣ = 4 5 7 .