Solution

159143

Country
Age
13

Pick any integer number, N, with any number of digits. That number is a multiple of nine with a remainder of M, where M is between 0 and 8.

Take the tens digit and the ones digit from your number N. Let's assume that the ones digit is a larger digit than the tens digit. (Later below you will see that this also works where they are the same and where the tens digit is larger than the ones digit.) Subtract the tens digit from the ones digit and call that D.

If you add D to the tens digit, now the tens digit looks like what the ones digit used to look like, but your number N went up by 10*D. If you subtract D from the ones digit in your number N, the ones digit now looks exactly like the tens digit, but your number N went down by D. Since the ones digit looks like what the tens digit used to look like and the tens digit looks like what the ones digit used to look like, you have swapped the two digits. In doing the swap, you went up by 10*D and down by D, so overall your number N increased by 9*D. (If the ones digit were less than the tens digit, your number N would decrease by 9*D in the swap and if they were equal, your number N would not change.)

So, by swapping two adjacent digits, you changed the value of your number N by 9*D, which is obviously a multiple of nine. If all you ever do is swap adjacent digits, you will only ever increase or decrease the value of N by some multiple of nine. Any permutation of digits (a listing of digits in order) can be obtained from any other permutation by just doing a sequence of adjacent digit swaps, so therefore any permutation of the same set of digits can only add or subtract some multiple of 9.

If you subtract one permutation of the digits N from another permutation of the digits of N, you are subtracting a multiple of 9 plus a remainder M from another multiple of 9 plus that same remainder M, so the result of the subtraction of those two permutations has to be a multiple of 9.

this was hard