First, reduce the sample set. For each digit of ABCDEFGHI, such that the last

- digit, (current digit), is the same as a multiple of N
- A: Any number 1-9 B: Even numbers 2,4,6,8 (divisible by 2). C: Any number 1-9 (21,12,3,24,15,6,27,18,9). D: Even numbers 2,4,6,8 (divisible by 4, every other even). E: 5 (divisible by 5 and 0 not allowed). F: Even numbers (12,24,6,18) G: Any number 1-9 (21,42,63,14,35,56,7,28,49). H: Even numbers (32,24,16,8) I: Any number 1-9 (81,72,63,54,45,36,27,18,9)

Since E must be 5, I can eliminate it everywhere else. Since I will use up all the even digits, (2,4,6,8) filling in those spots

that must be even. Any number becomes all odds, except 5.

A: 1,3,7,9 B: 2,4,6,8 C: 1,3,7,9 D: 2,4,6,8 E: 5 F: 2,4,6,8 G: 1,3,7,9 H: 2,4,6,8 I: 1,3,7,9

We have that 2C+D=0 (mod 4), and since C is odd, this implies that D is 2 or 6; similarly we find that H is 2 or 6 ==> {B,F} = {4,8}. D+5+F=0 (mod 3) ==> if D=2 then F=8, if D=6 then F=4.

We have two cases.

Assume our number is of the form A4C258G6I0. Now the case n=8 ==> G=1,9; case n=3 ==> A+1+C=0 (mod 3) ==> {A,C}={1,7} ==> G=9, I=3. The two numbers remaining fail for n=7.

Assume our number is of the form A8C654G2I0. The case n=8 ==> G=3,7. If G=3, we need to check to see which of 1896543, 9816543, 7896543, and 9876543 are divisible by 7; none are.

If G=7, we need to check to see which of 1896547, 9816547, 1836547, and 3816547 are divisible by 7; only the last one is, which yields the solution 3816547290.