Lately I stumbled over permutations and noticed a funny fact: When you take any integer, produce a permutation and subtract one form the other, you always get a multiple of 9.

It works with a any length. Some examples:

Length 2

23 – 32 = -9

84 – 48 = 36

60 – 06 = 54

Length 3

123 – 132 = -9

and so on…

It still works for changing the front position:

123 – 213 = -90

In fact it works for changing any position:

123 – 321 = -198 (-22*9)

This leads to the conclusion I stated in the beginning. The difference of any permutation of the same number is a multiple of 9. Feel free to check it with you favorite numbers.

It’s not a great mathematical invention (if it is, please let me know), but I didn’t know it, didn’t expect it und find it kind of fascinating. I asked a couple of friends and no one was aware of this.

I still try to find a way to use these fact, maybe for spell-check-like for numbers or a fast calculation of permutations, but so far it seems just useless

Instead I can provide a proof for numbers of any length and I’ll post it here in ten days from today. Meanwhile I want you to try it yourself. The proof is really, really simple, almost trivial and it won’t cost you more than five minutes to understand it all.

Please email or comment your solution!

February 18th, 2009 at 12:05 pm

not a strict proof:

1. if a number is |abc| and (a+b+c)%9=0, then |abc|%9=0 because 100a+10b+c = 100(a+b+c)-90b-99c

2. suppose we are doing |abc|-|cba|, the sum of every digit of the new number will be (a-c)+(b-b)+(c-a)=a-a+b-b+c-c=0, and 0%9=0

see?

February 18th, 2009 at 2:04 pm

Please generalize for bases other than 10.

February 18th, 2009 at 2:46 pm

I will. It’s pretty simple. It works for any base. The ‘magic’ number is always base-1. If you permute hexadecimals you alway get multiples of 15 as a difference .-)