Divisible from 1 to 9  math puzzle
Find a number consisting of 9 digits in which each of the digits from 1 to 9 appears only once. This number should satisfy the following requirements:
a. The number should be divisible by 9.
b. If the most right digit is removed, the remaining number should be divisible by 8.
c. If then again the most right digit is removed, the remaining number should be divisible by 7.
d. etc. until the last remaining number of one digit which should be divisible by 1.
a. The number should be divisible by 9.
b. If the most right digit is removed, the remaining number should be divisible by 8.
c. If then again the most right digit is removed, the remaining number should be divisible by 7.
d. etc. until the last remaining number of one digit which should be divisible by 1.
Explanation
The number is 381654729 because
381654729 / 9 = 42406081
38165472 / 8 = 477068
3816547 / 7 = 545221
381654 / 6 = 63609
38165 / 5 = 7633
3816 / 4 = 954
381 / 3 = 127
38 / 2 = 19
3 / 1 = 3
How do you find this number?
Let's call the digits of the number G we are looking for respectively a1 till a9. So G = a1a2a3a4a5a6a7a8a9. For convenience we define G(1) = a1, G(2) = a1a2, ..., G(9) = G.
Step 1.
It is immediately clear that a5 = 5, because if there are only 5 digits left then we have G(5) which should be divisible by 5. That is only possible if a5 = 5.
Step 2.
An odd number is not divisible by an even number.
Hence a2,a4,a6 and a8 should be even, because they were not, G(2) would not be divisible by 2, G(4) not by 4, etc.
So a2,a4,a6,a8 = 2,4,6 or 8.
Step 3.
Because there are 4 even numbers in G, which are used for a2,a4,a6 and a8, the digits a1,a3,a5,a7 and a9 are necessarily odd.
Using step 1, a1,a3,a7,a9 = 1, 3, 7 or 9.
Step 4.
G(6) has to be divisible by 6. A number is divisible by six, it should be even and the sum of its digits should be divisible by 3. Since a6 is even, G(6) is even as well. G(6) is divisible by 3 if a1+a2+a3+a4+a5+a6 is divisible by 3. Because G(3) is divisible by 3 by construction, a1+a2+a3 is divisible by 3. So G(6) is divisible by 3 3 if a4+a5+a6 is divisible by 3 as well. From step 1 it follows that a5 = 5. So a4a5a6 is either 258, 456, 654 or 852. But from these four numbers, only 258 and 654 are divisible by 3.
Hence: a4a5a6 = 258 or 654.
Step 5.
Because 200, 400, 600, 800 and 1000 are divisible by 8, a number in which the second to last digit is even, is divisible by 8 if the number formed using the last two digits is divisible by 8. For example, 234216 is divisible by 8 because the twee second to last digit (2) is even, and because 16 is divisible by 8.
a6 is even. So G(8) is divisible by 8 if a7a8 is divisible by 8. a7 is an odd number, a8 even.
So the only possibilities are: a7a8 = 16, 32, 72, 96.
Step 6.
From Step 4 it follows that either a4 = 2 or 6.
If a4 = 2, then a6 = 8 (Stap 4), a8 = 6 (Step 5). Using Step 5 it follows that a7 = 1 or 9.
If a4 = 6, then a6 = 4 (Stap 4), a8 = 2 (Step 5). Using Step 5 it follows that a7 = 3 of 7.
As a consequence, a2 is either 4 or 8 .
Step 7.
A number is divisible by 3 if the sum of its digits is divisible by 3. Because G(3) has to be divisible by 3, and using that a2 = 4 or 8 (Step 6), the following possibilities arise: G(3) = 147, 183, 189, 381, 387, 741, 783, 789, 981, 987.
Step 8.
A number is divisible by 9 if the sum of its digits is divisible by 9. For the number G we are looking for this is always the case because 1+2+3+4+5+6+7+8+9 = 45, which is divisible by 9.
Using the results of the previous steps, we find the following possibilities for G. 147258963
183654729
189654327
189654723
381654729
741258963
789654321
981654327
981654723
987654321
We did not check yet wether G(7) is divisible by 7. The possibilities above can easily be checked one by one. It turns out that from these numbers only G(7) = 3816547 is divisible by 7.
So we found the number, there is only one possibility and it is G = 381654729.
381654729 / 9 = 42406081
38165472 / 8 = 477068
3816547 / 7 = 545221
381654 / 6 = 63609
38165 / 5 = 7633
3816 / 4 = 954
381 / 3 = 127
38 / 2 = 19
3 / 1 = 3
How do you find this number?
Let's call the digits of the number G we are looking for respectively a1 till a9. So G = a1a2a3a4a5a6a7a8a9. For convenience we define G(1) = a1, G(2) = a1a2, ..., G(9) = G.
Step 1.
It is immediately clear that a5 = 5, because if there are only 5 digits left then we have G(5) which should be divisible by 5. That is only possible if a5 = 5.
Step 2.
An odd number is not divisible by an even number.
Hence a2,a4,a6 and a8 should be even, because they were not, G(2) would not be divisible by 2, G(4) not by 4, etc.
So a2,a4,a6,a8 = 2,4,6 or 8.
Step 3.
Because there are 4 even numbers in G, which are used for a2,a4,a6 and a8, the digits a1,a3,a5,a7 and a9 are necessarily odd.
Using step 1, a1,a3,a7,a9 = 1, 3, 7 or 9.
Step 4.
G(6) has to be divisible by 6. A number is divisible by six, it should be even and the sum of its digits should be divisible by 3. Since a6 is even, G(6) is even as well. G(6) is divisible by 3 if a1+a2+a3+a4+a5+a6 is divisible by 3. Because G(3) is divisible by 3 by construction, a1+a2+a3 is divisible by 3. So G(6) is divisible by 3 3 if a4+a5+a6 is divisible by 3 as well. From step 1 it follows that a5 = 5. So a4a5a6 is either 258, 456, 654 or 852. But from these four numbers, only 258 and 654 are divisible by 3.
Hence: a4a5a6 = 258 or 654.
Step 5.
Because 200, 400, 600, 800 and 1000 are divisible by 8, a number in which the second to last digit is even, is divisible by 8 if the number formed using the last two digits is divisible by 8. For example, 234216 is divisible by 8 because the twee second to last digit (2) is even, and because 16 is divisible by 8.
a6 is even. So G(8) is divisible by 8 if a7a8 is divisible by 8. a7 is an odd number, a8 even.
So the only possibilities are: a7a8 = 16, 32, 72, 96.
Step 6.
From Step 4 it follows that either a4 = 2 or 6.
If a4 = 2, then a6 = 8 (Stap 4), a8 = 6 (Step 5). Using Step 5 it follows that a7 = 1 or 9.
If a4 = 6, then a6 = 4 (Stap 4), a8 = 2 (Step 5). Using Step 5 it follows that a7 = 3 of 7.
As a consequence, a2 is either 4 or 8 .
Step 7.
A number is divisible by 3 if the sum of its digits is divisible by 3. Because G(3) has to be divisible by 3, and using that a2 = 4 or 8 (Step 6), the following possibilities arise: G(3) = 147, 183, 189, 381, 387, 741, 783, 789, 981, 987.
Step 8.
A number is divisible by 9 if the sum of its digits is divisible by 9. For the number G we are looking for this is always the case because 1+2+3+4+5+6+7+8+9 = 45, which is divisible by 9.
Using the results of the previous steps, we find the following possibilities for G. 147258963
183654729
189654327
189654723
381654729
741258963
789654321
981654327
981654723
987654321
We did not check yet wether G(7) is divisible by 7. The possibilities above can easily be checked one by one. It turns out that from these numbers only G(7) = 3816547 is divisible by 7.
So we found the number, there is only one possibility and it is G = 381654729.
