The total number of four digit numbers such that each of the first three digits is divisible by the last digit, is equal to ______.
Solution
Core idea. A condition tying digits to the last digit is handled one last digit at a time.
Concept refresher. A digit is divisible by when
for a whole number ; in particular zero is divisible by every non-zero .
Picture the situation. Let the last digit be . Division by zero has no meaning, so runs from 1 to 9. The first digit must be a multiple of from 1 to 9, and the second and third digits multiples of from 0 to 9, where 0 counts as a multiple. A larger leaves fewer choices.
Approach. Count the numbers for each last digit and add.
Step 1: Last digit 1 or 2
For every digit works, giving . For the first digit is 2, 4, 6 or 8 and the middle digits are 0, 2, 4, 6 or 8, giving .
Step 2: Last digit 3 or 4
For the first digit is 3, 6 or 9 and the middle digits are 0, 3, 6 or 9, giving . For the choices are 4 or 8 and 0, 4 or 8, giving .
Step 3: Last digit 5 to 9
The first digit must be itself and each middle digit 0 or , giving 4 numbers for each of the five values, 20 in all. The total is .
Answer. 1086
Sanity check. For the last digit 5 the four numbers are 5005, 5055, 5505 and 5555, which confirms the count of 4.
Common wrong answers
- 833: Not counting 0 as divisible by the last digit gives 729, 64, 27, 8 and 5 for the cases, which add to 833.
- 1066: Stopping at the last digit 4 and leaving out the last digits 5 to 9 gives 1066.
Key takeaway
The trap. Zero is a multiple of every non-zero digit, but it cannot be the first digit.
How toppers think. They group the last digits 5 to 9, which all behave alike.
Remember. Zero is divisible by every non-zero number.