Problem:
How many five-digit numbers (that is, between and ) contain no zeros and are multiples of ?
Problem:
How many five-digit numbers (that is, between and ) contain no zeros and are multiples of ?
Solution:
The answer is . To determine exactly how many numbers we need to count, let us first recall that a number is divisible by if and only if it is divisible by and by , and the divisibility criteria tell us that:
- The last two digits of the number must form a multiple of .
- The sum of the digits of the number must be divisible by .
The idea on which this solution is based is that of "generating" all the possible numbers of this type by choosing the digits in order from the last to the first.
a. First let us count in how many ways we can choose the last two digits: they must form a two-digit multiple of that contains no zeros, and the possibilities for this choice are (all the multiples of less than are , but from these we must discard , which contain at least one zero).
b. The second and third digits of the number can each be chosen in different ways (all the digits from to ) independently of all the other digits. Now we still have to choose the first digit of the number, and take care of divisibility by .
c. The first digit can be chosen in different ways, but not all these choices allow us to obtain divisibility by . However, since the nine digits from to have equal remainders upon division by in groups of three, once we have fixed all the preceding digits exactly of the possible choices for the first digit are acceptable.
Summing up, we can choose a number satisfying the required conditions in different ways. It is easy to check that in this way we generate all the chosen numbers, since the divisibility criteria are necessary and sufficient conditions.
Solution:
Let us first impose that the number be a multiple of ; then its last two digits must be one of the multiples of between and ; such multiples are , but among these there are that contain at least one zero and must therefore be discarded. We are left with possibilities for the final digits. Now we must choose the other three digits (nonzero) so that the sum of all five digits is a multiple of , in order to guarantee divisibility by . Using congruences modulo , we observe that, for every possible remainder of division by , there are exactly numbers between and that give that remainder (; ; ). Up to order, the various remainders modulo can be obtained as the sum of remainders in the following ways:
To also take order into account, we observe that can be permuted in ways, and similar ones have no permutations, while all the others can be permuted in ways. Therefore, taking order into account, every remainder can be written in different ways as the sum of remainders; hence, for a fixed remainder, we can form a -digit number giving that remainder and containing no in ways, and therefore, regardless of which last two digits we choose, we will have ways to complete the number so that it is a multiple of , without inserting zeros. In total we will therefore have ways.