In 1949, Indian mathematician D. R. Kaprekar discovered a strange property of the number 6174,
now known as Kaprekar's routine. It works like this:
How I stumbled onto this
I built a spreadsheet that ran every possible 4-digit combination (excluding the repeated-digit
ones) through the reorder / reverse / subtract cycle, feeding each result back in until it hit
6174. Kaprekar was, unsurprisingly, correct — every single one got there. The fastest
was numbers like 0026, which reach 6174 in a single step. The slowest, needing
the full seven iterations, included numbers like 9985.