2

Given a permutation, for example:

1234 1243 . . 4321

Can anybody explain why the differences between numbers are always (no proof, but for all simple permutations) divisible by 9?

PaulQ
  • 23
  • possibly answered here http://math.stackexchange.com/questions/1437918/show-that-n-m-is-a-multiple-of-9-when-n-and-m-have-same-digits – Joffan Nov 13 '16 at 02:55

2 Answers2

2

The digit sum $S()$ of a number $x$, $S(x) \equiv x \bmod 9$.

Therefore every digit permutation $\pi()$ of a number has the same residue $\bmod 9$. This means that the difference between them has zero residue $\bmod 9$:

$x-\pi(x) \equiv S(x) - S(x) \equiv 0 \bmod 9$

And thus the difference is divisble by $9$.

Joffan
  • 39,627
2

The difference between two numbers of that type is the sum of terms like this:

\begin{equation} x(10^p-10^q) \end{equation}

where $x$ is one of the digits (1,2,3 or 4). If $p>q$ you can write: \begin{equation} 10^p-10^q=10^q(10^{p-q}-1) \end{equation}

the term between brackets is a power of 10 minus 1, so it is divisible by 9. If $p<q$ is analogous to $p>q$ and for $p=q$ we have $10^p-10^q=0$ (divisible by 9).

MattG88
  • 2,534
  • 2
  • 13
  • 15
  • An example: $3421 - 1234 = 2187$ which isn't a difference of powers of $10$ and not even, so factoring $3$ out, $2187 = 3 \cdot 729$. But this doesn't look like a difference of powers of $10$ either; am I misunderstanding something? – pjs36 Nov 13 '16 at 03:08
  • @pjs36 In your example: $3421 - 1234 = 2187=3(10^3-10^1)+4(10^2-10^0)+2(10-10^2)+1(10-10^3)$, all the terms between brackets are divisible by 9. – MattG88 Nov 13 '16 at 03:14
  • Got it, thank you -- completely overlooked the "is a sum of" part of sum of terms like this. – pjs36 Nov 13 '16 at 03:16
  • @MattG88 the last term should have been 1(10^0 - 10^3), which confused me for about a year. From 1234 .. 4321 curious symmetry in 10^p - 10^q, in that p == q = 24, p > q = 36 and p < q = 36! Have a hunch that the nth combination is possible without recursion? – PaulQ Jan 04 '18 at 23:44
  • @PaulQ Yes you are right;-)...my oversight – MattG88 Jan 05 '18 at 00:44