UPSC CSAT 2025 Q25: Numbers Not Divisible by 2, 3, 5, 7, 9 — Solved
Consider the first 100 natural numbers. How many of them are not divisible by any one of 2, 3, 5, 7 and 9 ?
- 20
- 21
- 22
- 23
Answer: (c) 22
Solution
-
Drop the redundant divisor. Any number divisible by 9 is also divisible by 3. Once we remove the multiples of 3, the multiples of 9 are already gone. So the condition becomes: not divisible by 2, 3, 5 or 7.
-
Plan. Count the numbers from 1 to 100 that are divisible by at least one of 2, 3, 5, 7. Use inclusion-exclusion. Then subtract that count from 100.
-
Single divisors. Use ⌊100/k⌋ for each. - Multiples of 2: ⌊100/2⌋ = 50 - Multiples of 3: ⌊100/3⌋ = 33 - Multiples of 5: ⌊100/5⌋ = 20 - Multiples of 7: ⌊100/7⌋ = 14 - Sum = 50 + 33 + 20 + 14 = 117
-
Pairs. Use the LCM of each pair. These numbers are counted twice in step 3. - 2 and 3 → 6: ⌊100/6⌋ = 16 - 2 and 5 → 10: ⌊100/10⌋ = 10 - 2 and 7 → 14: ⌊100/14⌋ = 7 - 3 and 5 → 15: ⌊100/15⌋ = 6 - 3 and 7 → 21: ⌊100/21⌋ = 4 - 5 and 7 → 35: ⌊100/35⌋ = 2 - Sum = 16 + 10 + 7 + 6 + 4 + 2 = 45
-
Triples. - 2, 3, 5 → 30: ⌊100/30⌋ = 3 - 2, 3, 7 → 42: ⌊100/42⌋ = 2 - 2, 5, 7 → 70: ⌊100/70⌋ = 1 - 3, 5, 7 → 105: ⌊100/105⌋ = 0 - Sum = 3 + 2 + 1 + 0 = 6
-
All four. 2 × 3 × 5 × 7 = 210. ⌊100/210⌋ = 0.
-
Divisible by at least one. 117 − 45 + 6 − 0 = 78.
-
Divisible by none. 100 − 78 = 22.
-
Check by listing. A number up to 100 with no factor 2, 3, 5 or 7 is either 1 or has every prime factor ≥ 11. The product of two such primes is at least 11 × 11 = 121, which is more than 100. So every such number other than 1 is a prime from 11 to 97. There are 25 primes below 100. Remove 2, 3, 5 and 7 to get 21. Add the number 1 to get 22. - The list: 1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.
Answer: 22
Option-wise explanation
- a: incorrect — 20 would need two numbers dropped from the true list of 22. You get it from an arithmetic slip, such as a wrong floor value in one inclusion-exclusion term (for example 100/7 taken as 13), or from leaving out 1 and miscounting the primes.
- b: incorrect — This is the most common trap. 21 counts only the primes from 11 to 97 and forgets the number 1. One is divisible by none of 2, 3, 5, 7 or 9, and it is one of the first 100 natural numbers, so it must be counted.
- c: correct — Inclusion-exclusion gives 78 numbers divisible by at least one of 2, 3, 5, 7. That leaves 100 − 78 = 22. The direct check agrees: the number 1 plus the 21 primes from 11 to 97.
- d: incorrect — 23 counts one number too many. Usually 1 is counted along with 25 − 3 primes because one of 2, 3, 5, 7 was not removed. A sign error in the triples term of inclusion-exclusion can also produce it.
How to eliminate
Prime shortcut (fastest). Note that 9 adds nothing because of 3. A number up to 100 with no factor 2, 3, 5 or 7 cannot be composite, since its smallest possible composite is 11 × 11 = 121. So it is either 1 or a prime from 11 to 97. Most aspirants know there are 25 primes below 100. Take away 2, 3, 5 and 7 to get 21, then add 1 to get 22.
The four options sit one apart, so estimates such as 100 × (1/2)(2/3)(4/5)(6/7) ≈ 22.9 cannot separate them. You need the exact count. The key decision is whether to include 1. The options 21 and 22 are set to catch exactly that.
Time: about 30–45 seconds with the prime shortcut, or 90–120 seconds with full inclusion-exclusion. Attempt it in the first pass.
Know more
Counting numbers that avoid a set of divisors
To count the numbers from 1 to N that are divisible by none of the primes p, q, r, …:
Count = N − Σ⌊N/p⌋ + Σ⌊N/(pq)⌋ − Σ⌊N/(pqr)⌋ + …
Rules that save time:
- Remove redundant divisors first. Drop 9 when 3 is present, and 4 or 8 when 2 is present. Pairs then use the LCM, not the plain product.
- Use the prime shortcut when N is small. If the smallest prime you are allowed is p and p² > N, the survivors are just 1 and the primes from p to N.
- Use the periodic shortcut when N is a multiple of the full product. The count is N × (1 − 1/p)(1 − 1/q)…
| Term | Sign | What it corrects |
|---|---|---|
| Singles ⌊N/p⌋ | − | removes the multiples |
| Pairs ⌊N/pq⌋ | + | adds back numbers removed twice |
| Triples ⌊N/pqr⌋ | − | removes numbers added back once too often |
Worked variant. How many numbers from 1 to 60 are divisible by none of 2, 3, 4 and 5?
- 4 is redundant because of 2.
- 60 is a multiple of 2 × 3 × 5 = 30, so the periodic shortcut applies: 60 × (1/2) × (2/3) × (4/5) = 16.
- Check with inclusion-exclusion: 60 − (30 + 20 + 12) + (10 + 6 + 4) − 2 = 60 − 62 + 20 − 2 = 16.
Always check whether 1 is included.