### Nine Digit Number - Math Puzzle

Source: Sent to me by Sudeep Kamath via http://puzzletweeter.com/2013/06/21/884/

Problem:
Find a nine digit number abcdefghi that uses all the digits 1,2,3,...9 exactly once and satisfies:
a is divisible by 1
ab (2 digit number with digits a and b) is divisible by 2
abc (3 digit number with digits a, b and c) is divisible by 3
.......
.......
abcdefghi is divisible by 9.

Update (29/06/2013):
Solution: Posted by JDGM, Anti, Meghana Kolan, Shwetabh Sameer and Unknown in comments! A more detailed solution provided by me in comments!

### Comments

1. 381654729

I noticed e must be 5 and b, d, f, h each even. There are 24 permutations of those evens and 24 permutations of the remaining odds. That already narrows us down to 24² possible abcdefghi and instead of pushing on by hand I wrote a quick and dirty program to check which of those it was.

2. 381654729

The divisibility for 7 was a mess though. Does anybody have an elegant method for that?

3. 381654729
Let Dn be the digit n
D5 = 5
D2, D4, D6, D8 - even
D1, D9 , D3, D7 - odd
D1 can be any odd number so is D9 since the sum of the digits is always a multiple of 9
D3-D4 should be a multiple of 4 and owing to the fact that D3 should be odd we have D4 = 2 or 6
Assuming D1-D2-D3 is a multiple of 3 (for it to be divisible by 3), we need D4-D5-D6 to be an even nultiple of 3 leaving us with D4-D5-D6 = 258 or 654
D6-D7-D8 has to be a multiple of 8 which gives us D6-D7-D8 = 432 or 472 or 816
Using ---65432 , ---65472, ---25816 and accounting for its divisibility by 3 and 7 we get the above result.

4. This comment has been removed by the author.

5. 381654729 is the answer. Write a simple code and you'll get the same.

6. 381654729
Yeah. 7 was a pain. :-)

7. Thanks for the solution. Just providing a more detailed solution.

e is 5.
a, c, g, i are odd - 1, 3, 7, 9
b, d, f, h are even - 2, 4, 6, 8

cd is divisible by 4 and c is odd, implies d is either 2 or 6
abc, abcdef, abcdefghi is divisible by 3

So, abc, def, ghi are divisible by 3

def is divisible by 3 would mean it is one out of
258
654

abcdefgh is divisible by 8, means
fgh is divisible by 8
Since f is either 8 or 4, gh is divisible by 8
gh is one of 16, 32, 72, 96

ghi is divisible by 3. Hence possible options for ghi: 321, 327, 723, 729, 963

In summary:
def is 258 or 654
ghi is 321, 327, 723, 729 or 963
a, c are odd - 1, 3, 7, 9
b is even - 2, 4, 6, 8
abc is divisible by 3
abcdefg is divisible by 7

Assuming def is 258:
def is 258
ghi is 963
a, c are odd - 1, 7
b is even - 4
abcdefg is divisible by 7

1472589 mod 7
7412589 mod 7 are both not zero

No solution

Assuming def is 654:
def is 654
ghi is 321, 327, 723, 729
a, c are odd - 1, 3, 7, 9
b is even - 8
abc is divisible by 3
abcdefg is divisible by 7

Possible options:
a8c654321 - a/c are 7/9
a8c654327 - a/c are 1/9
a8c654723 - a/c are 1/9
a8c654729 - a/c are 1/3

8 options to be checked for divisibility by 7

a8c6543 mod 7 = a + 5 + 4*c + 5 = a+4*c+3
a8c6547 mod 7 = a + 5 + 4*c + 2 = a+4*c

Possible options:
a8c654321 - a/c are 7/9 ( 0 mod 7 for abcdefg gives no solution )
a8c654327 - a/c are 1/9 ( 0 mod 7 for abcdefg gives no solution )
a8c654723 - a/c are 1/9 ( 0 mod 7 for abcdefg gives no solution )
a8c654729 - a/c are 1/3 ( 0 mod 7 for abcdefg gives a=3, c=1 )

So, the number is
381654729

8. Brilliant Explanantion ...