6174 — The Number That Eats Numbers

Give it any four-digit number you like. It will hand you back 6174 in seven steps or fewer. Every time. Try to break it.

The magic trick

The routine, step by step

How long does it take?

Every valid 4-digit number, sorted by how many steps it needs. Nothing takes more than 7. Nothing.

The rules

  1. Take any 4-digit number, using at least two different digits (leading zeros are fine — 0011 counts).
  2. Arrange the digits in descending order.
  3. Arrange them in ascending order.
  4. Subtract the smaller from the larger.
  5. Repeat with the result.

The only numbers that fail are repdigits — 1111, 2222, 5555 — which go straight to 0 and stay there. Every single other one lands on 6174.

Perform it on someone

Ask for a 4-digit number with at least two different digits. Have them do the routine on paper while you look away. Before they finish, write 6174 on a card and put it face down. Works on anyone who hasn't seen it. Works on mathematicians too — they just enjoy it more.

D. R. Kaprekar, 1949

Dattatreya Ramchandra Kaprekar was a schoolteacher in Devlali, India. He had no research position and published in small journals; for years, professional mathematicians treated his work as recreational trivia. Then people started checking.

His routine has a fixed point: a number that maps to itself. Run the operation on 6174:

7641 − 1467 = 6174

That alone isn't remarkable. What is remarkable is that 6174 is an attractor: every one of the 8,991 valid four-digit starting points is pulled into it, and always within seven steps. There is no second fixed point and no cycle to get trapped in.

Why does it work?

The subtraction only cares about the multiset of digits, not their order, so instead of 10,000 starting numbers there are only 715 genuinely different cases. That's small enough to check exhaustively by hand — which is what Kaprekar did. Write the digits sorted as a ≥ b ≥ c ≥ d, and the subtraction always reduces to:

1000(a−d) + 100(b−c) + 10(c−b) + (d−a) = 999(a−d) + 90(b−c)

So every result after step one is a multiple of 9, drawn from a short list of possibilities. Follow the arrows and they all funnel into 6174. Beautiful, and completely elementary — you could verify the entire proof in an afternoon with a pencil.

Elsewhere in the number system