KAPREKAR.FUN

Sign up for Starlink and get €45

Fast, reliable internet at home and on the go. Sign up through our link and get €45 in cash or Starlink service credit. Terms apply.
Get €45

Kaprekar's Constant6174

The number that finds itself.

Enter any four-digit number with at least two different digits and follow Kaprekar's routine. In at most seven iterations, the process reaches the mysterious number 6174.

Try the 6174 Calculator

4/4

Try this one

7910 →(9710 − 0179)= 9531
9531 →(9531 − 1359)= 8172
8172 →(8721 − 1278)= 7443
7443 →(7443 − 3447)= 3996
3996 →(9963 − 3699)= 6264
6264 →(6642 − 2466)= 4176
4176 →(7641 − 1467)= 6174

Maximum path · 7 iterations

The whole number space

Explore All 4-Digit Inputs

This visualization plots all 10,000 zero-padded 4-digit inputs from 0000 to 9999 on the horizontal axis. The vertical axis shows how many Kaprekar iterations are required to reach 6174 or the special destination 0000.

Open the complete visualization →

EXPERIMENT

How does 6174 work?

Sort the digits high-to-low and low-to-high, then subtract. Repeat the ritual.

Discover

EXPLORE

Meet every input

Search and filter all 10,000 zero-padded 4-digit inputs.

Discover

CHALLENGE

Take the long way

Can you find a number that needs all seven iterations?

Discover

What Is Kaprekar's Constant?

Kaprekar's constant is the number 6174. It appears when a simple digit-sorting routine is applied repeatedly to a four-digit number containing at least two different digits. The process was described by Indian mathematician D. R. Kaprekar, whose recreational discoveries showed how surprising structure can emerge from elementary arithmetic.

The constant is a fixed point: arranging its digits gives 7641 and 1467, and 7641 − 1467 returns 6174. Once a path arrives there, every later step stays there too.

How Kaprekar's Routine Works

Take the same four digits, arrange them from largest to smallest, arrange them again from smallest to largest, and subtract the smaller value from the larger one. Preserve leading zeroes so the calculation always remains four digits, then repeat with the result.

Learn how Kaprekar's routine works →

Why Does 6174 Work?

Sorting makes many differently ordered inputs equivalent. Their subtraction results merge into shared paths, and those paths funnel toward 6174. Exhaustively calculating all 10,000 zero-padded 4-digit inputs from 0000 to 9999 confirms that every non-repdigit reaches it within seven iterations. Repdigits such as 1111 instead subtract immediately to 0000.

Explore all 4-digit inputs →See the iteration statistics →

Keep learning

Articles on numbers and patterns

Proof idea

Why does every number reach 6174?

The algebra behind the routine: why only 54 first results are possible and how they all funnel into one fixed point.

History

Who was D. R. Kaprekar?

A schoolteacher from Devlali who never held a research post, yet gave his name to one of the best-known number curiosities.

Beyond four digits

Kaprekar’s routine with 2, 5, 6 and 7 digits

Only three and four digits have a single destination. Other widths split into loops and competing fixed points.

Famous sequences

The Fibonacci sequence explained

Rabbits, ratios, the 60-step cycle of last digits and what the sequence really does in plants.

Separating fact from legend

The golden ratio: facts and myths

Where φ provably appears, and why the nautilus, the Parthenon and the “perfect face” do not belong on the list.

An unsolved problem

The Collatz conjecture (3n + 1)

A rule a child can follow that nobody has been able to prove always ends at 1.

Browse all articles →

Common questions

Frequently Asked Questions

What is Kaprekar’s constant?

Kaprekar’s constant is 6174, a fixed point reached by repeatedly sorting and subtracting the digits of almost every four-digit number.

Why is 6174 special?

After reaching 6174, the routine produces 7641 − 1467 = 6174, so the value repeats. Every valid four-digit input reaches it within seven iterations.

Does every four-digit number reach 6174?

Every four-digit number containing at least two distinct digits does. Repdigits such as 1111 are the exception and converge to 0000.

Why do leading zeroes matter?

The routine must preserve four digits. For example, 999 is written as 0999, making the next subtraction 9990 − 0999.

What is the maximum number of iterations?

No valid four-digit starting number needs more than seven subtractions to reach 6174.

Is there a three-digit Kaprekar constant?

Yes. Three-digit numbers with at least two distinct digits converge to 495 under the same routine.

Who discovered 6174?

Indian mathematician and teacher D. R. Kaprekar presented this remarkable property of 6174 in 1949.

Sign up for Starlink and get €45

Fast, reliable internet at home and on the go. Sign up through our link and get €45 in cash or Starlink service credit. Terms apply.
Get €45
KAPREKAR.FUN

A playground for curious numbers.

info@kaprekar.fun