How many numbers from 1 to 1000 are there which are NOT divisible by a

How many numbers from 1 to 1000 are there which are NOT divisible by any of the digits 2, 3 and 5 ?

166
266
357
366
This question was previously asked in
UPSC CAPF – 2015
We need to find the number of integers from 1 to 1000 that are not divisible by 2, 3, or 5. This is equivalent to finding the total number of integers minus the number of integers that are divisible by at least one of 2, 3, or 5.
Using the Principle of Inclusion-Exclusion:
Total numbers = 1000
Let A be the set of numbers divisible by 2, B by 3, C by 5.
|A| = floor(1000/2) = 500
|B| = floor(1000/3) = 333
|C| = floor(1000/5) = 200
|A ∩ B| (divisible by 6) = floor(1000/6) = 166
|A ∩ C| (divisible by 10) = floor(1000/10) = 100
|B ∩ C| (divisible by 15) = floor(1000/15) = 66
|A ∩ B ∩ C| (divisible by 30) = floor(1000/30) = 33
Number of elements divisible by at least one of 2, 3, or 5 is:
|A U B U C| = |A| + |B| + |C| – (|A ∩ B| + |A ∩ C| + |B ∩ C|) + |A ∩ B ∩ C|
= 500 + 333 + 200 – (166 + 100 + 66) + 33
= 1033 – 332 + 33 = 701 + 33 = 734
The number of numbers NOT divisible by any of the digits 2, 3, and 5 is:
Total Numbers – |A U B U C| = 1000 – 734 = 266.
The problem requires finding numbers relatively prime to the product of the given digits (2*3*5=30) within a range. The Principle of Inclusion-Exclusion is a standard method for counting elements in the union of sets.
Alternatively, this can be viewed as finding numbers whose prime factors are not 2, 3, or 5. The fraction of such numbers up to N is approximately N * (1 – 1/p₁) * (1 – 1/p₂) * …, where p₁, p₂, … are the prime factors. For 30, the prime factors are 2, 3, 5. So the fraction is (1 – 1/2)(1 – 1/3)(1 – 1/5) = (1/2)(2/3)(4/5) = 8/30 = 4/15. Approximate count = 1000 * (4/15) ≈ 266.67. The inclusion-exclusion method gives the exact integer count.
Exit mobile version