The seven-digit number has to end with four odd digits, meaning either
1234567 is used, or 3456789. Except that 3456789 sums to 42, which is
divisible by 3, and so 1234567 must be the digits used.
Only subtracting 4 from the left yields a sum divisible by 3, and
subtracting 7 from the right leaves a 6-digit number divisible by 3 but
not 9. So far we've got:
4XXXXX7
To make numbers not divisible by 3, we with a bit of trial and error get
4625317.
Praise be to modular arithmetic!
--
Ted S.
fedya at hughes dot net
Now blogging at
http://justacineast.blogspot.com