See below:
Let’s say the number is ABCDEFGHI (each letter is one of the digits from 1 to 9). The rules say that A has to be divisible by 1, AB by 2, etc. Here are the observations:
1. Whatever the final number, the rules for A and I will always be satisfied (every digit is divisible by 1, and the sum of all the digits is divisible by 9).
2. E must be 5.
3. B, D, F and H must be even digits. Since there are only 4 even digits anyway, they must belong in these positions. Therefore, A, C, G and I must be the remaining (1, 3, 7 and 9).
4. Since ABC is divisible by 3, to get ABCDEF divisible by 6, we need DEF also divisible by 3. I.e., D + E + F must be divisible by 3. Of all the combinations possible for DEF (254, 256, 258, 452, 456, 458, 652, 654, 658, 852, 854 and 856), only four are valid: 258, 852, 456 and 654.
5. CD must be divisible by 4. No matter what C is (whether 1, 3, 7 or 9), C8 and C4 do not work. So, DEF can only be 258 or 654.
6. FGH must be divisible by 8. Again, trying all combinations possible (814, 816, 834, 836, 874, 876, 894, 896, 412, 418, 432, 438, 472, 478, 492 and 498), the only valid ones are: 816, 896, 432 and 472.
7. So, the number can only be one of these four:
A4C25816I, A4C25896I, A8C65432I and A8C65472I.
8. A + B + C must be divisible by 3. Trying out all possible combinations for A and I, and eliminating invalid ones, we are left with these 10 numbers:
147258963, 741258963, 189654327, 981654327, 789654321, 987654321, 183654729, 381654729, 189654723 and 981654723.
9. Quickly checking the last condition (divisibility by 7) against each of the 10, we see that only 381654729 fits.
(Reference: http://discuss.joelonsoftware.com/default.asp?interview.11.330437.