Kaprekar's Constant 6174
Home · Interesting Math Problems · Problem 21 · Growth & numbers

1. The problem

Take any four-digit number whose digits are not all the same, say 3524. Arrange its digits in descending order (5432) and ascending order (2345) and subtract:

5432 − 2345 = 3087  →  8730 − 0378 = 8352  →  8532 − 2358 = 6174  →  7641 − 1467 = 6174 …

Try another start. And another. Where do you end up?

2. The answer

6174
Every four-digit number (digits not all equal, leading zeros kept) reaches 6174 and then stays there: 7641 − 1467 = 6174.
≤ 7 steps
No start needs more than seven subtractions. For three-digit numbers the same routine ends at 495 within six steps.

3. Why it works

Write the digits in order a ≥ b ≥ c ≥ d. Then

abcd − dcba = 999(a − d) + 90(b − c)

So the result depends only on two differences, a − d (1 to 9) and b − c (0 to a − d). After the very first step there are only about 50 possible numbers, and one can simply check them all — the map squeezes everything into a tiny set, which funnels into the single fixed point 6174. It is a proof by exhaustion rather than an elegant argument, which is part of its charm.

D. R. Kaprekar, a school teacher from Devlali, Maharashtra, found it in 1949. He also discovered Kaprekar numbers (45² = 2025 and 20 + 25 = 45) and self numbers.

4. Try it

Digits: Start

How many steps do all starting numbers need?

5. Fine print

  • Keep leading zeros: 2111 − 1112 = 0999, and the next step uses 9990 − 0999 = 8991.
  • For two digits the routine falls into a loop (63 → 27 → 45 → 09 → 81 → 63) instead of a single number; for five digits there are loops too. Four and three digits are special.