The Mathematics Behind 6174

Kaprekar’s routine produces a surprising result from trivially simple steps. Underneath the trick, however, is some genuinely interesting number theory. This page walks through why 6174 is special, why the routine converges, and what happens when you change the digit count or the number base.

6174 as a Fixed Point

A fixed point of a function f is a value x for which f(x) = x. Applied to Kaprekar’s routine, a fixed point is a number that, when you rearrange and subtract, produces itself.

For 6174, the descending arrangement is 7641 and the ascending arrangement is 1467. Subtracting:

7641 − 1467 = 6174

So 6174 maps to itself. The routine has found its destination and cannot leave.

In 1981, G. D. Prichett, A. L. Ludington, and J. F. Lapenta proved formally that 495 (3 digits) and 6174 (4 digits) are the only cases in base 10 where every valid starting number converges to a single Kaprekar fixed point. Some other digit lengths (6, 8, 9) have multiple fixed points and so lack a single universal Kaprekar constant; others (2, 5, 7) enter cycles rather than stopping at a fixed value.

Why Every Result is a Multiple of 9

Here is a small but elegant observation. At every step of Kaprekar’s routine, the result is a multiple of 9.

The reason is straightforward. Rearranging the digits of a number does not change its digit sum — the sum of its digits. And two integers with the same digit sum leave the same remainder when divided by 9. So when you subtract one from the other, you are subtracting two numbers with the same remainder modulo 9, and the difference is necessarily divisible by 9.

This is why, when you watch Kaprekar’s routine in action, every intermediate result is something like 3087, 8352, 6264, 6174 — all multiples of 9. This observation alone shrinks the search space of possible results dramatically, which is part of why convergence is so fast.

Proof Sketch: Why Convergence is Guaranteed

A full proof that every four-digit non-repdigit converges to 6174 in at most seven steps is a case-analysis argument: you enumerate the possible digit patterns and show that each reaches 6174.

The key insight is that after one iteration, the result is always one of a relatively small set of multiples of 9 with particular digit patterns. After two iterations, the set shrinks further. By iteration seven, every starting point has funnelled into 6174, with no exceptions.

This is not an aesthetic proof but a combinatorial one. It works because four-digit numbers with at least two distinct digits form a finite, well-behaved set, and the Kaprekar map on that set has a single attractor.

Other Properties of 6174

The number 6174 has several curious properties in its own right:

These properties are not responsible for 6174’s role as a Kaprekar constant — that role comes from its behaviour under the digit-rearrange-and-subtract map. But they make 6174 a quietly rich number in its own right.

What About Other Digit Lengths?

Kaprekar’s routine can be applied to numbers of any digit length. The behaviour varies:

This irregular pattern is itself a topic of active recreational-maths interest. Why do 3 and 4 digits get single clean constants while most other lengths do not? The answer lies in combinatorial constraints that are easy to state but tedious to enumerate.

Bases Other Than 10

Kaprekar’s routine is base-dependent. In base 4, for example, numbers of the form 3021, 310221, 31102221, and so on are fixed points. The pattern generalises: in base b, certain digit strings serve the same role that 6174 serves in base 10.

This base-dependence is part of what makes Kaprekar’s routine such a useful pedagogical example. It is not a deep theorem about integers — it is a statement about how we write integers. Change the notation and you change the fixed points.

Further Exploration

← Back to the solver