Divisibility Puzzle Solution

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:

  • The number should be divisible by 9.
  • If the right-most digit is removed, the remaining number should be divisible by 8.
  • If the two right-most digits are removed, the remaining number should be divisible by 7.
  • If the three right-most digits are removed, the remaining number should be divisible by 6.
  • ...
  • If the eight right-most digits are removed, the remaining number should be divisible by 1.




Solution:

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

Other than using guess-and-check, how would one find such a number?

Let's call the digits of the number N we are looking for respectively d1 to d9. Thus, we have that N = d1d2d3d4d5d6d7d8d9.

To simplify notation, define N(1) = d1, N(2) = d1d2, ..., N(9) = N.


Step 1: d5 = 5.

It is clear that d5 = 5, because if there are only 5 digits left then we have N(5) which needs to be divisible by 5. The only way that this can happen is if the right-most digit is a 0 or a 5. However, we cannot use 0, so we have that d5 = 5.


Step 2: d2, d4, d6, d8 = 2, 4, 6 or 8.

Recall that an odd number is not divisible by an even number. Thus, d2, d4, d6 and d8 should be even, because if they were not, then N(2), N(4), N(6) and N(8) would not be divisible by 2. So, d2, d4, d6, d8 = 2, 4, 6 or 8.


Step 3: d1, d3, d7, d9 = 1, 3, 7 or 9.

Because there are 4 even numbers in N, which are used for d2, d4, d6 and d8, the digits d1, d3, d7 and d9 are necessarily odd. Using Step 1, we see that d1, d3, d7, d9 = 1, 3, 7 or 9.


Step 4: N(6) has to be divisible by 6.

Recall, a number is divisible by 6 if it is even and divisible by 3. A number is divisible by 3 if the sum of its digits are divisible by 3. Since d6 is even, N(6) is even as well. N(6) will be divisible by 3 if d1 + d2 + d3 + d4 + d5 + d6 is divisible by 3.

Since N(3) is divisible by 3 by construction, we know d1 + d2 + d3 is divisible by 3. Thus, N(6) is divisible by 3 (and hence divisible by 6) if d4 + d5 + d6 is divisible by 3.

From Step 1, we know that d5 = 5. Using Steps 2 and 3, we see that d4d5d6 is either 258, 456, 654 or 852. But out of these four numbers, only 258 and 654 are divisible by 3. Thus, d4d5d6 = 258 or 654.


Step 5: N(8) is divisible by 8.

Recall, a number is divisible by 8 if the third digit from the right is even and if the last two numbers are divisible by 8. For example, the number 316 is not divisible by 8 since 3 is odd, even though 16 is divisible by 8. Similarly, the number 2632 is divisible by 8 since 6 is even and 32 is divisible by 8.

So N(8) is divisible by 8 if d7d8 is divisible by 8. (Recall, we already have that d6 is even, so we don’t need to check that condition.) Now, d7 is an odd number and d8 is even. So the only possibilities are: d7d8 = 16, 32, 72, 96.


Step 6: d4, d8 = 2 or 8, d2, d6 = 4 or 8.

From Step 4, we have that d4 = 2 or 6. From Step 5, we have that d8 = 2 or 6. Thus, it follows that d2 and d6 must be either 4 or 8, the other two even numbers.


Step 7: Possibilities for N(3).

As we said earlier, a number is divisible by 3 if the sum of its digits is divisible by 3. Since N(3) is divisible by 3, and using Step 6 (d2 = 4 or 8), we have the following ten possibilities for N(3): 147, 183, 189, 381, 387, 741, 783, 789, 981, 987.


Step 8: N(9) is divisible by 9.

A number is divisible by 9 if the sum of its digits is divisible by 9. For the number N 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.


Step 9: Finding N.

Using the results of the previous steps, we find the following ten possibilities for N:

     147258963
     183654729
     189654327
     189654723
     381654729
     741258963
     789654321
     981654327
     981654723
     987654321

The one piece of information that we have not used is the fact that N(7) needs to be divisible by 7. Checking the above ten possible numbers for N, we see that only N(7) = 3816547 is divisible by 7.

Thus, we that N = 381654729.



Main || Personal | Puzzles | Divisibility Solution