Finding the nine...

This challenging puzzle comes from our good friend James Grime — thanks James!

Find a nine digit numbers, using the numbers 1 to 9, and using each number once without repeats, such that; the first digit is a number divisible by 1. The first two digits form a number divisible by 2; the first three digits form a number divisible by 3 and so on until we get a nine digit number divisible by 9.

You might try, for example, the number 923,156,784. But this number doesn't work — the first three digit number, 923, is not divisible by 3. Can you find a nine digit number that works?

Hint: you don't need a computer to find it. Try looking at your clock instead....

James Grime is a lecturer and public speaker on mathematics, and can be mostly found touring the country on behalf of the Millennium Mathematics Project carting his trusty Enigma Machine. If you'd like James and the machine to visit your school, visit the Enigma website.

You can also read more from James in his article, Curious Dice.


381654729 is not unique.
963258147 also works.

Sorry 963258147 fails on division by 8

Can somebody explain the reference to looking at the clock

Stuart Barker

I think "looking at the clock" is meant to suggest using modular arithmetic. I have heard modular arithmetic explained that way before (i.e. for an analog clock, the hour is incremented modulo 12).

btw, I think the answer is unique.

number is 987654321

No it's not. It fails at 7th digit, 9876543 is not divisible by 7.

Sure it is.
9876543/7 = 1410934.714285714....

Did you mean "evenly divisible"?

you have missed the 'spirit' of the question - as well you know!

The answer will always be |o| or in simpler terms 0.0 :)
I find it weird it's not possible on a calculator
1=0 so does 0

No, Zero is not a 9 digit number, until you write zero like 000000000

In that case, every number is divisible by every number.. hence, all 9 digit numbers would be solutions.. :- ) But, you seem to missed the point.

Anil Sharma

381654729 WORKS!!!

9 plus 6 equals 15 which is NOT divisible by 2!


This doesnt work on division by 7 : 9876543/7 = 1410934.714... hence not evenly divisible, the only solution is 381654729


Let the number be abcd5fghi. It's clear that the fifth digit has to be 5. b, d, f and h are elements of {2,4,6,8} and the remaining a, c, g and i are elements of {1,3,7,9}. So there are at most 24 * 24 = 576 possibilities. But we can limit these possibilities drastic. 2c + d has to be divisible by 4, 4d + 20 + 4f by 6 and 2g + h by 4. Now you will find only one possibility: 381654729

Best answer by far.

please explain the 2nd to last line about divisibility

I found at least two numbers 921,252,564 and 987,654,564

I don't think you heard the question correctly. go back and listen taking note about how many times each digit can appear

errrr. I don't think you heard the question right. It said you could only use every digit once...

E=5 because multiples of 5 end in 5 or 0
Alternate digits must be even, so the rest have to be odd.
Digits C and D have to go "odd,even", and make a number which is a multiple of 4. So D has to be 2 or 6.
Ditto position H- must be 2 or 6.
The only even numbers left are 4 and 8, and these must go in B and F.
Looking at the first three digits, whose digital root must be 3,6 or 9, there are 9 options for filling these given the conditions we've already worked out.
We tried each of these in turn and worked out the digital root up to F. This also has to be 3,6 or 9 to make it divisible by 6. So you can work out in each case whether D is 2 or 6.
From this we can see what H is as one of its options has been used.
Only two digits remain- we test whether either makes a multiple of 7 when put in position G.
Finding that one of these works, check that the first 8 digits are divisible by 8.
After this only one answer remains:

(Also, has anyone noticed the patterns this and other suggestions make on the calculator buttons? They are symmetrical or generally interesting.)
If you followed that, I'm impressed. :)

How come the digits need to alternate even/odd?

Because even numbers are evenly divisible only by other even numbers.


123456789 is also a correct answer .

Sorry 1234 is not divisible by 4

123456789 is not a correct answer I'm afraid :(


Sorry not correct because 986 is not divisible by 3

here i have one possible solution.

Sorry this is not correct because all the number 1..9 should occur once

I found this in 15 seconds, mentally. 14 here.

2431 is not divisible by 4.

If we generalize this problem to other bases, these are what you get.

For Base 2 (binary), there are no solutions.

For Base 4 (quaternary), there are two solutions: 123 and 321.

For Base 6 (senary), there are two solutions: 14325 and 54321.

For Base 8 (octal), there are six solutions: 1274563, 3254167, 5234761, 5614723, 5674321, and 7234561.

I have yet to do the odd bases or the bases higher than 10 (decimal).

For Base 2 an admittedly somewhat trivial solution becomes apparent if you append a final zero as you can in the case of any base b so that you get a final number divisible by b as well. So you can divide 1 by 1 in Base 2, and then 10 by 2 (ie divide 10 by 10 base 2) just as you can divide 3816547290 by 10 Base 10.

By my reckoning three of the solutions you give for octals are in error: 127456 and 561472 aren't divisible by 6, and in the last, 723 isn't divisible by 3.

But hey, the other three are three more than what I found!

Have you got anywhere with solutions for other bases? One clue is that for an even base b the middle number must be b/2, so 6 for base 12 as 5 for 10, 4 for 8 etc.

I'm embarrassed to report that your solutions for octals are correct after all. (Editor: Please remove that bit of my reply if you can!!)

It's me again - I said that my post in reply to "Generalizing to other bases" erroneously attributed an error, but I just checked again and find I was in fact right after all, the contributor had indeed made a mistake in some of his solutions, so best let my first reply stand. But please do some checking yourselves to settle the matter! (Remembering of course to use an octal calculator which displays to the right of the octal point).

I've found a number which is satisfies conditions similar to those for 381654729 but with a more orderly progression of digits:


111111 is divisible by 1, and 111111222222 by 2, 111111222222333333 by 3, 111111222222333333444444 by 4 all the way up to that number above, which is divisible by 9.

Moreover the divisors can also consist of six digits: 111111222222 is divisible by 222222; 111111222222333333 by 333333 and so on.

So far I've only got this to work with a dividend consisting of each digit repeated six times, and divisors consisting of either one or six repeated digits.

(PS I sent this direct to James Grime as well, who said it was nice. The highest compliment)

Chris G

How can 1234 is divisible by 4

And if u r trying to use 1111222233334444 then
We can use every digit once only

B=8, D=6, E=5, F=4, H=2

1. A and C= 1 and 3; G=7; I=9
2. A and C= 1 and 9; G and I = 3 and 7
3. A and C= 7 and 9; G=3; I=1


These 8 numbers satisfy all the conditions except for divisibility by 7.
Is there a way to get the correct answer without checking each number individually?

Yes, it's very interesting how 7 is so often the one problem non-divisor when all the others fit neatly in. I also encountered that in the course of building up to that remarkable number in my previous post. (I'm not bragging, the number's remarkable, not me). For example


works for each digit except 7 or 777. Damn! It's only when I got up to groups of six repdigits that 7 finally toed the line along with all the others and divided in where it should. Yet golly, when it does divide it does so in spades.

Look at that number again:


Each individual repdigit group of six is divisible by 7. Not only that, each successive group of groups is as well. For example 111111222222 is, and 111111222222333333, and so on.

I'm not going any further for now. After six digits I shall rest with the seventh.

Chris G

is there any number which satisfies every condition???

There are three sequences that aren't divisible by their last digit: 1234 isn't divisible by 4, 1234567 by 7, or 12345678 by 8. Either replace the last digit in each case with 2, or add 2, and the situation is rectified.

What about the reverse of the 1-9 sequence? 987654321 is divisible by 9, 98765432 by 8, 987654 by 6, 98765 by 5, 9876 by 4, 987 by 3, 98 by 2, 9 by 1. This time only 7 is the snag (as usual) since 9876543 isn't divisible by 7, so we have to add 2 again.

What about dividing the reverse by the last digit? 9 is divisible by 9, 98 isn't divisible by 8, ah but 987 is actually divisible by 7, and the others going downwards are also divisible by their last digit except 987654 isn't divisible by 4. So this time subtract 2 from the odd ones out.

Chris G

now try it in hex ;)


This number by dividing as mentioned in question without repetition works...plzz check

My no. is 126357984