Kaprekar’s constant
Why does every number go to 6174?
Real math, checked case by case
Take any four digit number whose digits are not all the same, arrange its digits largest first and smallest first, subtract, and repeat. You always reach 6174 within seven steps, and 6174 gives itself back: 7641 − 1467 = 6174. It happens because the answer depends only on two gaps between the digits, so almost ten thousand starting numbers funnel into just 54 possible differences, and every one of those drains into 6174. The Indian mathematician D. R. Kaprekar found it in 1949.
Tap any square to start from it. Darker squares are further from 6174.
The reason
Only two numbers matter
Call the digits, sorted, a ≥ b ≥ c ≥ d. The largest arrangement is abcd and the smallest is dcba. Subtract one from the other and the place values do most of the work: the answer is always 999 × (a − d) + 90 × (b − c).
So the actual digits do not matter, only the gap between the biggest and smallest digit, and the gap between the middle two. The first gap runs from 1 to 9 and the second can never be bigger than the first. That makes 54 possible answers after the first step, whatever you started with. Yutaka Nishiyama pointed out in Plus magazine that many of those share the same digits, which leaves 30 cases to follow.
From there it is a finite check, and every path ends at 6174, the one four digit number that gives itself back. Nobody has found a deeper reason than that. Nishiyama wrote that “it might just be incidental.”
Every difference is also a multiple of 9, because a number and any shuffle of its digits leave the same remainder after dividing by 9. That is the nine rule at work, and it is why 6174’s digits add to 18.
Other lengths
Only three and four digits have one answer
Three digits all fall to 495, within six steps. Two digits never settle: they loop 9, 81, 63, 27, 45 and back to 9. Five digits have no single answer at all, only three loops, such as 71973, 83952, 74943, 62964 and round again.
Six digits have two numbers that give themselves back, 549945 and 631764, but we ran all million six digit strings and 93.6% of them never reach either. They fall into a seven number loop that passes through 420876 and 851742.
Change the base and 6174 disappears too. In base 5 the four digit routine settles on a different number, and in base 12 it splits into two loops. You can watch that happen on the base switch. In 1981 a group of mathematicians showed that in base 10, 495 and 6174 are the only numbers of this kind.
Who was Kaprekar?
Dattatreya Ramchandra Kaprekar (1905 to 1986) taught school in Devlali, Maharashtra, from 1930 to 1962, and spent his spare time on number puzzles. He also named Kaprekar numbers, Harshad numbers and self numbers. Fame came late, when Martin Gardner wrote about him in his Scientific American column in March 1975.
Real vs legend
6174, sorted
| Claim | Status |
|---|---|
| Every four digit number reaches 6174. | Almost · 1111, 2222 and the rest go to 0 |
| It never takes more than 7 steps. | Real · Checked |
| The difference is always 999 × (a − d) + 90 × (b − c). | Real · Proven |
| It works for any number of digits. | No · only 3 and 4 digits |
| 6174 is a universal constant. | No · base 10 only |
| 6174 is linked to 3, 6 and 9. | Legend · every difference is a multiple of 9 |
Questions
Kaprekar’s constant
Why is 6174 a magic number?
Because it is the only four digit number that Kaprekar’s routine sends back to itself: 7641 − 1467 = 6174. Every other four digit number with at least two different digits reaches it within seven steps.
Why does Kaprekar’s constant not work with 1111?
When all four digits are the same, the largest and smallest arrangements are equal, so 1111 − 1111 = 0 and the routine stops. The ten repdigits, 0000 to 9999, are the only numbers that do not reach 6174.
Is Kaprekar’s constant useful?
Not for anything practical. It is recreational math, and teachers use it to show how repeating a simple step can settle on a fixed point.
Is 1234 a Kaprekar constant?
No. 1234 is a starting number, and it reaches 6174 in three steps: 4321 − 1234 = 3087, 8730 − 0378 = 8352, 8532 − 2358 = 6174.
Is there a three digit version of 6174?
Yes, 495. Every three digit number whose digits are not all the same falls to 495, within six steps. 954 − 459 = 495 gives itself back.
Who discovered 6174?
D. R. Kaprekar, a schoolteacher and recreational mathematician from Devlali, India, in 1949. He published it in the journal Scripta Mathematica. Sources disagree on whether that was in 1949 or 1955.
Sources
Where this comes from
- Yutaka Nishiyama, “Mysterious number 6174,” Plus magazine, 2006, the 999 and 90 formula, the 30 cases and the step table: plus.maths.org.
- Kaprekar’s routine, other lengths and bases: Wikipedia.
- D. R. Kaprekar, life and work: Wikipedia.
- Eric W. Weisstein, “Kaprekar Routine”: MathWorld.
- Kaprekar numbers, his other named numbers: Wikipedia.
Share
An image of your number's path to 6174. Copy link reopens it.
Poster
All 54 squares and their paths into 6174, on one print.