Proof idea
Why does every number reach 6174?
4 min read · Updated 19 September 2026
Kaprekar’s routine looks like a magic trick: take almost any four-digit number, sort, subtract, repeat, and you land on 6174 within seven steps. The surprise fades once you look at the algebra. This article shows why the first subtraction already throws away most of the information in the input, and how the remaining possibilities can be checked completely.
Start with the sorted digits
Call the four digits of the input a, b, c and d, already sorted so that a ≥ b ≥ c ≥ d. The descending number is abcd and the ascending number is dcba. Written out in place value:
descending = 1000a + 100b + 10c + d
ascending = 1000d + 100c + 10b + a
difference = 999(a − d) + 90(b − c)
That last line is the whole secret. The difference does not depend on the four digits individually. It depends only on two gaps: the gap between the largest and smallest digit, a − d, and the gap between the two middle digits, b − c.
Only 54 first results are possible
For a number that is not a repdigit, the outer gap a − d is between 1 and 9. The inner gap b − c can be anything from 0 up to a − d, because the middle digits sit between the outer ones. Counting the combinations gives 2 + 3 + 4 + … + 10 = 54.
So although there are 9,990 valid four-digit inputs (10,000 minus the ten repdigits 0000, 1111, …, 9999), the very first subtraction can produce only 54 different numbers. An exhaustive check with the numbers explorer confirms exactly 54 distinct first results. The routine collapses a space of almost ten thousand inputs into a few dozen states in one move.
This also explains why rearranging the digits of your starting number never changes the path after step one: 3524, 5243 and 2435 have the same sorted digits, so they share the same gaps and the same first difference.
Every result is a multiple of 9
Both 999 and 90 are divisible by 9, so every result of the routine is a multiple of 9. 6174 = 9 × 686 fits the pattern. This is the same reason that a number and any rearrangement of its digits always leave the same remainder when divided by 9, which is explored in digital roots and casting out nines.
Multiples of 9 have digit sums that are also multiples of 9. For a four-digit result that means a digit sum of 9, 18, 27 or 36, which further limits where the routine can go next.
Following the 54 states to the end
Once the problem has shrunk to 54 numbers, a complete proof is simply to apply the routine to each of them and record where it goes. Many of the 54 map onto each other at the second step, the paths keep merging, and every one of them ends at 6174. Kaprekar himself verified the property this way, with patience rather than a computer.
Why 6174 and not some other number? A fixed point must satisfy an unusual condition: its own digits, sorted and subtracted, must return the same number. Sorting 6174 gives 7641 and 1467, and 7641 − 1467 = 6174. Checking all candidates shows that 6174 is the only non-zero four-digit number with this property, so every path that stops, stops there.
Why at most seven steps?
The longest route in the merged network of paths has seven arrows. Computing all 10,000 inputs gives this exact distribution of iteration counts:
| Iterations to 6174 | Number of inputs |
|---|---|
| 0 | 1 (6174 itself) |
| 1 | 383 |
| 2 | 576 |
| 3 | 2400 |
| 4 | 1272 |
| 5 | 1518 |
| 6 | 1656 |
| 7 | 2184 |
The average valid input needs about 4.67 subtractions. Three steps is the most common count, while 2,184 inputs, about 22%, need the full seven. You can explore the same figures interactively on the statistics page.
The three-digit version is even simpler
For three digits a ≥ b ≥ c, the middle digit cancels completely:
(100a + 10b + c) − (100c + 10b + a) = 99(a − c)
The first result depends only on a − c, so there are just nine possible values: 099, 198, 297, 396, 495, 594, 693, 792 and 891. Each of them reaches 495 within a few more steps, and no three-digit input needs more than six. The 495 calculator shows these paths directly.
What the proof does not say
The argument depends on the digit width. With five digits there is no fixed point at all, and with six digits there are two fixed points plus a loop. The four-digit case is special, not typical. See Kaprekar’s routine with other digit lengths for the full picture.
Try it yourself: pick a number, compute a − d and b − c, and predict the first result with 999(a − d) + 90(b − c) before checking it in the 6174 calculator.