Is it possible to write a nine-digit number so that its first digit is divisible by 1, its two first digits are divisible by 2, its three first digits by 3, and so on until the whole nine-digit number is divisible by 9?
Let's try to build such a number starting from left to right, digit by digit. Any number from 1 to 9 will work to start with, as every integer is divisible by 1. Let’s say number three:
3
The second digit must be even to ensure that the entire number is divisible by 2. Let’s say 4. So, our number is now
34
Ok, do you remember the divisibility rule for 3? Sure, the sum of the digits has to be divisible by 3. The number
342
fulfills the rule (3+4+2=9), and so do the numbers 345 and 348. But let’s continue with 342. I like that number.
The divisibility rule for 4? The last two digits have to be divisible by 4. The number
3428
is suitable, as 28 is divisible by 4 (so the entire number is divisible by 4, too). If we add the digit 0 or 5 to the right we would have a number divisible by 5. As we are not using the digit 0 (remember: only from 1 to 9), the only option is
34285
All right. The rule for 6? The number should be divisible by both 2 (so it must end in an even digit) and 3 (so their digits must add up to a multiple of three). The number
342852
will do (and also 342858, which is 6 units more... but I like the former more, for no reason).
We are on the right track. There are only three digits left! Let’s add another one that makes the number divisible by 7... Well, I have to confess that I don’t remember the divisibility rule for 7 (it’s a bit tough) but I do know how to divide. So, let me try my luck with the number 3428529 (I have put 9 as a possible seventh digit). I take my pencil, divide 3428529 by 7 and… bad luck, the division is not exact: It gives a remainder of 6. But that’s the clue… if we subtract 6 units to the failed candidate 3428529, we get for certain a number divisible by 7:
3428523
Ugh... we are almost done. With the same trick applied to number 8 we can get the next digit and then write
34285232
Finally, a number is divisible by 9 if its digits add up to a number that is divisible by 9 (yeah, I do remember the rule for 9!). I'm going to add... 3+4+2+8+5+2+3+2=29... so we must add 7 as the final digit to allow the sum to be 36, which is a multiple of 9. Perfect, we are done! Our number is:
342852327
Wow, we did it!
Can you make other numbers with the same property? Sure you can as there are many more choices (concretely 2,492 altogether). These numbers are called polydivisible numbers.
But don’t relax, yet... You know that mathematicians like to impose additional conditions in order to complicate things. For example, if each number from 1 to 9 is allowed to appear exactly once, is it now possible to build a polydivisible number with the nine digits? The answer is yes, but this time there is a unique solution: 381654729 (see references on the web for a witty deduction… or try it by yourself)
And you also know that mathematicians love generalizing. So, we can consider polydivisible numbers with more than 9 digits. For instance, 10200056405 is a 12-digit polydivisible number (you can check it). Obviously numbers from 0 to 9 can be repeated. With many digits involved getting a polydivisible number becomes more and more difficult. Then, the burning question is: Are there infinitely many polydivisible numbers? And the answer is… nope. There are only 20,456 polydivisible numbers altogether, with
3 608 528 850 368 400 786 036 725
being the longest one. In fact, this is the only 25-digit number that is polydivisible. The next graph shows the number of
polydivisible numbers in terms of the number of digits… read the last sentence again and more slowly if needed ;-)
The density of n-digit polydivisibility numbers can be defined as the ratio between the number of polydivisible numbers with n digits and the total numbers with n digits (i.e. 10n). For 1-digit numbers the density is 1 (all numbers are polydivisible), while for 26-or-more-digit numbers the density is strictly zero (none is polydivisible). Have a look at the graph below.