6174 · Kaprekar's black hole

Kaprekar's routine: take any four-digit number, sort its digits high to low, subtract the low-to-high version, repeat. Everything falls into 6174.

Pick any four digits

How it works

The routine

How Kaprekar's routine works

Kaprekar's routine is four operations you repeat until the number stops changing. It works on any four-digit number, including ones that start with a zero.

  1. Write the number with four digits, keeping any leading zeros.
  2. Sort the digits from largest to smallest — the high number.
  3. Sort the same digits from smallest to largest — the low number.
  4. Subtract low from high, then start again with the result.

Starting from 3524, three rounds are enough:

Kaprekar's routine applied to 3524
StepHighLowDifference
1543223453087
2873003788352
3853223586174

The constant

Why it always ends at 6174

6174 is a fixed point. Its digits sort to 7641 and 1467, and 7641 − 1467 is 6174 again — once a number arrives, it stays. No other four-digit number does this.

Everything else drains towards it. Of the 10 000 four-digit strings, only the ten repdigits — 1111, 2222 and so on — fail, and they fail immediately: their high and low numbers are equal, so the difference is 0000. The remaining 9990 all reach 6174, and none of them needs more than seven steps. That upper bound is exact, not an estimate: there are only 715 possible digit multisets to check, so the whole claim can be verified by exhaustion.

The keypad on this page refuses four of a kind and nothing else, so all 9990 working numbers are reachable. Repeated digits are fine — and unavoidable in any case, since they turn up mid-fall: 1112 drops through 0999 and 8991 on its way down.

How long the fall takes

Steps needed by the 9990 four-digit numbers that converge
StepsNumbersShare
0 (6174 itself)10.01%
13833.8%
25765.8%
3240024.0%
4127212.7%
5151815.2%
6165616.6%
7218421.9%

Three steps is the most common outcome, but more than a fifth of all starting numbers take the full seven — which is why the animation on this page speeds up as it goes.

Questions

Common questions about 6174

What is 6174?

6174 is Kaprekar's constant. Sort the digits of any four-digit number from high to low, sort them low to high, subtract the second from the first, and repeat: the result always settles on 6174. It is the only four-digit number that maps to itself.

Does every four-digit number reach 6174?

Every one except the ten repdigits, which collapse to 0000 on the first subtraction. That leaves 9990 of the 10 000 four-digit strings, counting leading zeros, and all of them arrive within seven steps. Repeated digits are no obstacle — 1122 works, 1111 does not.

How many steps does it take to reach 6174?

At most seven. Three steps is the most common outcome, taken by 2400 of the 9990 numbers that converge; 2184 need the full seven, and 383 land on 6174 in a single step.

Who discovered Kaprekar's constant?

D. R. Kaprekar, an Indian schoolteacher from Devlali, described the routine in 1949. He worked on recreational number theory largely outside academic circles, and several other constructions carry his name.

Is there a three-digit version of Kaprekar's constant?

Yes — 495, reached in at most six steps. Two, five and six-digit numbers have no single constant; they fall into cycles instead.