The total number of numbers, lying between 100 and 1000 that can be formed with the digits 1, 2, 3, 4, 5, if the repetition of digits is not allowed and numbers are divisible by either 3 or 5, is
Solution
Core idea. Either of two properties: add the two counts and remove the overlap.
Concept refresher. For two properties and , the number of objects with at least one of them is
and the remaining objects have neither.
Picture the situation. A number between 100 and 1000 has three digits, here three different digits from 1 to 5. Divisibility by 5 depends on the last digit, and divisibility by 3 on the set of digits used. Numbers divisible by both would be counted twice, so they are subtracted once.
Approach. Count the numbers divisible by 5, by 3 and by both, then apply inclusion and exclusion.
Step 1: Divisible by 5
The last digit must be 5, and the first two places take two of the other 4 digits in order, giving numbers.
Step 2: Divisible by 3
The sets of three digits with a sum divisible by 3 are 1, 2, 3; then 1, 3, 5; then 2, 3, 4; then 3, 4, 5. Each gives numbers, so 24 in all.
Step 3: Both
A number divisible by both uses the set 1, 3, 5 or 3, 4, 5 with 5 last, which gives numbers. So the count is .
Answer. 32
Sanity check. The four numbers divisible by both are 135, 315, 345 and 435, each a multiple of 15.
Common wrong answers
- 36: Not subtracting the 4 numbers divisible by both gives 36.
- 28: Removing the overlap twice, as for numbers divisible by exactly one of them, gives 28.
Key takeaway
The trap. Numbers divisible by both appear in both counts.
How toppers think. They list the few numbers in the overlap to be sure of it.
Remember. Either: add the two counts, subtract the overlap.
More on Inclusion–Exclusion Principle
- The number of seven-digit numbers, that can be formed by using the digits 1, 2, 3, 5 and 7 such that each…
- The number of permutations, of the digits 1, 2, 3, …, 7 without repetition, which neither contain the string…
- The total number of 4-digit numbers whose greatest common divisor with 54 is 2, is
- All 7 on Inclusion–Exclusion Principle ›