[Math] Proof of convergence of Kaprekar’s Constant

elementary-number-theorynumber theoryrecreational-mathematicssequences-and-series

I've tried googling this one a bit but nothing seems to come up, even though its considered to be a well known fact.

Why does the kaprekar process of taking a 4 digit number: L, generating L' and L'' such that L' is the digits of L in ascending order and L'' is the digits in descending order and subtracting L' – L'' always converge to the Kaprekar constant of 6174?

Clearly the only value for which this process is constant is 6174 but that doesn't explain why there should be convergence.

One attempt at proof is to determine all the possible numbers that converge to 6174 after a single iteration, and then attempt to reason that each too can be reached by the convergence of even more numbers in such a way that if I continue this reasoning I should cover ALL 4 digit numbers.

But to turn my strategy into induction from brute force casework has become futile. What is the actual proof?

Best Answer

Somewhere I have a complete proof written out, but I'll just share a couple of random things here. First, with some work you can show that if two digits of a fixed point are equal, then three digits have to be equal, and in turn all four digits have to be equal, and hence you must have $0000$. So you can assume all the digits of a non-trivial fixed point are different.

Second, notice that after one iteration of the process, you must have a multiple of $9$. This considerably reduces the number of cases to check.

Of these multiples of $9$, if you do two iterations to all of them, you end up with a small set. Some clever things help you get a small system of equations to solve. If the snow ever melts in Austin, I might post the whole proof, if I can find it. I hope my hints help.