Find the minimum positive integer N containing each of the digits from 1 to 9 exactly once such that N is divisible by 99.
As N contains all the digits 19 exactly once each, it is necessarily divisible by 9, so all we need in addition is divisibility by 11.
123456789, the smallest such pandigital number, totals 25 in the odd positions and 20 in the even positions. The difference is not a multiple of 11. What's needed is either to get the difference down to zero or up to 11.
Interchanging two adjacent digits changes that oddeven difference by 2, so it's easier to get to a difference of 11, as 11 and 5 are both odd. Since we want to increase the difference by 6 we need to make three such interchanges, as near to the right side of the number as possible. As we want to increase the odd positions while decreasing the even sum, we swap 8 with 7, 6 with 5 and 4 with 3, making 124365879 the desired result.

Posted by Charlie
on 20140611 14:55:07 