The number of numbers greater than , less than and divisible by , that can be formed using the digits , if the repetition of the digits is allowed, is ______
Solution
Core idea. Divisibility by depends only on remainders, so group the digits by remainder and count patterns.
Concept refresher. For a whole number with digits ,
because on division by . When a choice is made in stages with ways at the stages, the number of ways is (the fundamental principle of counting); disjoint cases are added.
Approach. Use the range to fix the first digit, sort the digits by remainder modulo , and count the last three digits by the pattern of their remainders.
Step 1: Fix the first digit
A four-digit number from the digits that is greater than and less than must start with , since gives or more. The number itself has digit sum , not a multiple of , so it is not counted anyway.
Step 2: Sort the digits by remainder
Dividing by , the digits leave , the digit leaves , and leave . With first digit (remainder ), the other three digits must have remainders adding to or :
each in any order.
Step 3: Count each pattern
Each pattern has arrangements of its remainders, and each remainder is filled by , or digits:
In all numbers.
Answer. 42
Sanity check. A direct count over all numbers finds with digit sum divisible by (their digit sums leave remainders , , for , and of them). Example: has digit sum and .
Common wrong answers
- 83: Allowing first digit as well adds more and gives ; but every number starting with is at least , which is not less than .
- 6: Forbidding repetition leaves such numbers; the question allows repetition, so each of the last three places can take any of the five digits, giving .
- 41: Taking a third of the numbers and rounding down gives ; the remainders are not split evenly, and exactly of them are multiples of .
Key takeaway
The trap. Letting lead, which gives numbers of or more, outside the range.
How toppers think. They fix the forced digit first, then count the free digits by remainder classes.
Remember. A number is divisible by if and only if its digit sum is.