Everything Falls to 6174

  • Medium
  • Number puzzles
  • Tests: Following a process to its fixed point

The puzzle

Take any four-digit number whose digits are not all the same. Arrange its digits in descending order, then in ascending order, and subtract the smaller from the larger. Repeat with the result.

What happens, and how many steps does it take at worst?

Stuck?

One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.

Hint 1

Try 3524. Then try the number you get.

Hint 2

Try starting at 6174 itself.

Show the answer Hide the answer

Every such number reaches 6174 in at most seven steps, and 6174 then repeats forever: 7641 - 1467 = 6174.

How to get there

Start with 3524: 5432 - 2345 = 3087. Then 8730 - 0378 = 8352. Then 8532 - 2358 = 6174. Three steps.

And 6174 is a fixed point: its digits sorted down give 7641, sorted up give 1467, and 7641 - 1467 = 6174 exactly. Once there, the process never leaves.

Every four-digit number with at least two different digits arrives within seven steps - 9831 is one of the slowest. The reason it terminates at all is that the subtraction always gives a multiple of 9 and never leaves the four-digit range, so the process runs inside a finite set and has been checked exhaustively. Three-digit numbers have their own constant, 495; two-digit numbers cycle instead of settling.

The technique worth keeping

When a repeated operation maps a finite set into itself, it must eventually cycle. Look for fixed points by solving "the process leaves this unchanged", then check whether everything funnels into them.