Some numbers are famous because they are enormous. Others are famous because they appear everywhere.
6174 is famous because it is almost impossible to escape.
Take the number 3524.
Arrange its digits from largest to smallest, then from smallest to largest, and subtract:
5432 - 2345 = 3087Now do it again.
8730 - 0378 = 8352And again.
8532 - 2358 = 6174We have arrived.
But the strange part is not that this particular sequence produced 6174. The strange part is that almost every four-digit number does.
And once 6174 appears, it refuses to leave:
7641 - 1467 = 6174Do it again.
Again.
The number has become a mathematical destination.
Kaprekar’s Routine
The process is named after Dattatreya Ramchandra Kaprekar, an Indian schoolteacher and recreational mathematician who is generally credited with discovering the phenomenon in 1949. His work included several other unusual classes of numbers, but 6174 became his best-known discovery.
The procedure is wonderfully simple:
- Choose a four-digit number containing at least two different digits.
- Rearrange its digits into descending order.
- Rearrange those same digits into ascending order.
- Subtract the smaller number from the larger number.
- Treat the result as a four-digit number, adding leading zeros when necessary, and repeat.
We can describe the operation as a function. Let (D(n)) be the number formed by arranging the digits of (n) in descending order, and let (A(n)) be the number formed by arranging them in ascending order.
Then:
K(n) = D(n) - A(n)The function (K) is the Kaprekar operation.
For 3524,
K(3524) = 5432 - 2345 = 3087and repeated application gives
K^{3}(3524) = 6174where (K3) means applying the Kaprekar operation three times.
That notation makes something important visible.
This is not merely a number trick.
It is an iterative system.
Every Road Leads to 6174
For four-digit decimal numbers containing at least two distinct digits, repeated application of the Kaprekar routine reaches 6174 in no more than seven iterations.
Seven is not just an upper bound that never actually occurs.
Consider 1004:
4100 - 0014 = 4086 8640 - 0468 = 8172 8721 - 1278 = 7443 7443 - 3447 = 3996 9963 - 3699 = 6264 6642 - 2466 = 4176and finally,
7641 - 1467 = 6174Exactly seven iterations.
Then the system stops changing.
Or, more precisely, it continues operating but remains at the same value:
K(6174) = 6174In the language of dynamical systems, 6174 is a fixed point.
And that makes the number considerably more interesting than it first appears.
There Is One Important Exception
The rule requires at least two different digits.
Start with 4444, for example:
4444 - 4444 = 0000And then:
0000 - 0000 = 0000The same thing happens with 1111, 2222, 3333, and the other repeated-digit numbers.
They fall into 0000 instead of 6174.
So the claim is not that literally every possible four-digit string reaches 6174. It is that every four-digit decimal number with at least two distinct digits does.
That small qualification matters.
It also gives us another fixed point:
K(0000) = 0000But 0000 is the trivial one.
6174 is where the interesting mathematics lives.
Something Is Being Destroyed
Why should thousands of apparently different numbers all collapse toward the same result?
The answer begins with the sorting operation.
Suppose the four digits, after sorting, are
a \geq b \geq c \geq dThe descending number is
1000a + 100b + 10c + dwhile the ascending number is
1000d + 100c + 10b + aSubtract them:
\begin{aligned} K(n) &= (1000a + 100b + 10c + d) \\ &\quad - (1000d + 100c + 10b + a) \end{aligned}Collecting terms gives
K(n) = 999(a-d) + 90(b-c)That equation is the part of the story I find most revealing.
The original number had four digits.
But after sorting and subtracting, the next value depends only on two differences:
a-dand
b-cMuch of the information contained in the original number has vanished.
3524, 4253, 2435, 5342, and every other permutation of those same four digits are no longer different as far as the Kaprekar routine is concerned. Sorting makes them identical before the subtraction even begins.
The system is compressing its state space.
Repeatedly.
That begins to explain the convergence.
And Everything Becomes Divisible by 9
The same equation reveals another feature:
K(n) = 999(a-d) + 90(b-c)Both 999 and 90 are divisible by 9.
Therefore,
K(n) \equiv 0 \pmod{9}After only one iteration, every number produced by the routine is divisible by 9.
That is not a coincidence.
The descending and ascending numbers contain exactly the same digits, so they have the same digit sum. Two integers with the same digit sum have the same remainder modulo 9. Their difference must therefore be divisible by 9.
And sure enough,
6+1+7+4=18so
6174 \equiv 0 \pmod{9}Again, the routine is reducing the possibilities.
The apparent freedom of the starting number disappears very quickly.
Why 6174 Stays Put
Now look at 6174 itself.
Its digits in descending order are
7641and in ascending order,
1467so
7641 - 1467 = 6174Using our difference formula gives the same result.
Here,
a=7,\quad b=6,\quad c=4,\quad d=1Therefore,
a-d=6and
b-c=2so
\begin{aligned} K(6174) &= 999(6)+90(2) \ &= 5994+180 \ &= 6174 \end{aligned}The number reproduces itself.
That is the defining feature of the Kaprekar constant.
How Quickly Do Numbers Fall Into 6174?
I decided to check every ordinary four-digit starting value from 1000 through 9999, excluding the nine repeated-digit numbers 1111, 2222, and so forth.
That leaves 8,991 starting values.
The convergence is remarkably fast.

Figure 1. Number of Kaprekar iterations required to reach 6174 for every starting value from 1000 through 9999 except the nine repeated-digit numbers. The value 6174 itself requires zero iterations.
The most common journey takes only three iterations. In my enumeration, 2,124 starting values reached 6174 in exactly three steps.
At the opposite end, 1,980 numbers required the full seven iterations.
Across all 8,991 valid starting values, the average iteration was approximately \overline{N}_{\mathrm{steps}} \approx 4.679
So although seven steps can be necessary, a randomly selected ordinary four-digit starting number is typically swallowed by the Kaprekar process considerably sooner.
The funnel is steep.
A Tiny Dynamical System
This is where 6174 stops being a curiosity about subtraction and becomes something more interesting.
Imagine every four-digit number as a node in a network.
Draw an arrow from each number to the number produced by one Kaprekar operation:
n \longrightarrow K(n)Then draw another arrow:
K(n) \longrightarrow K^{2}(n)and keep going.
Thousands of different starting points begin feeding into shared intermediate states. Those states merge into still fewer states.
Eventually the paths converge.
For almost the entire nontrivial four-digit system, they terminate at the same node:
6174And that node points back to itself.
In dynamical-systems terminology, we can think of 6174 as an attractor, and the collection of starting values that eventually reach it as its basin of attraction.
Of course, this is a finite deterministic system rather than a continuous physical one. Nothing mysterious is pulling the numbers toward 6174.
The rules do it.
But that may be the most interesting part.
Order Emerging From an Almost Ridiculously Simple Rule
There is no probability in the Kaprekar routine.
No optimization.
No hidden choice.
No intelligence.
Take the digits. Sort them. Subtract. Repeat.
Yet a strong global pattern emerges.
That makes 6174 a miniature example of something that appears throughout mathematics and science: simple local rules can create surprisingly rigid large-scale behavior.
We see versions of this idea in cellular automata.
In iterative maps.
In fractals.
In differential equations.
In computer simulations.
The rules themselves can be almost embarrassingly simple. What happens after the rules are repeated may not be.
6174 gives us that lesson with arithmetic a child can perform.
6174 Is Also About Information
There is another way to look at the routine.
It destroys information.
Suppose I tell you that the output of one Kaprekar iteration is 3087.
Can you reconstruct the original starting number uniquely?
No.
Many different numbers can lead to the same result.
The map is many-to-one.
Once those different histories merge, the routine no longer remembers where they came from.
Iteration causes more and more paths to merge until the system has effectively forgotten almost everything about its initial state.
What survives is structure.
Eventually, for the four-digit decimal case, that structure is 6174.
Seen this way, Kaprekar’s routine is almost an information funnel.
Many possible states enter.
Far fewer distinct states survive.
Finally, almost everything exits through the same point.
It Is Not Just About Base 10
The phenomenon depends on the number of digits and the numerical base being used.
In ordinary base-10 arithmetic, there is a famous three-digit counterpart:
495because
954 - 459 = 495and the corresponding three-digit Kaprekar routine converges to 495 under the appropriate nontrivial starting conditions.
But change the number of digits or change the base, and the behavior can become much more complicated. Instead of one fixed point, systems may develop multiple fixed points or cycles.
In fact, Kaprekar dynamics remain an active mathematical subject. Recent work has studied the four-digit routine in other bases and found highly structured families of terminal cycles rather than simply reproducing the base-10 behavior of 6174.
So our little arithmetic trick opens the door to a much broader question:
What happens when a simple deterministic transformation is repeatedly applied to a finite universe of states?
That is no longer recreational arithmetic.
That is dynamics.
Why I Like 6174
6174 does not help us calculate the orbit of Mars.
It does not secure internet traffic.
It does not predict the stock market.
As far as I know, civilization would continue more or less unchanged if nobody had ever discovered it.
And yet I think that is part of its charm.
Kaprekar looked at ordinary decimal digits and asked what would happen if he performed a ridiculously simple operation again and again.
Most people would probably try it a few times, notice the pattern, and move on.
He paid attention.
There was structure hiding there.
That is one of the recurring pleasures of mathematics. The interesting thing does not always announce itself with an enormous theorem or an impossibly complicated equation.
Sometimes it is sitting inside four digits.
Sort them.
Subtract.
Repeat.
And no matter where you thought you were going, you discover that the road was leading to the same place all along.






















































