Kaprekar's Constant

A mathematical black hole that pulls almost any four-digit number into the exact same value after just a few subtractions.

Definition Kaprekar's constant is a fixed number reached when you rearrange the digits of a number in descending and ascending order and subtract the smaller from the larger. For four-digit numbers, as long as all digits are not identical, any starting number is guaranteed to converge to 6174 in at most seven steps.

The Magic Trick That Sucks Any Number into 6174

Pick any four-digit number made of at least two different digits. Let's try 2024 as an example.

First, arrange the digits in descending order to make the largest possible number (4220), and in ascending order to make the smallest number (0224). Next, subtract the smaller number from the larger one: 4220 - 0224 = 3996.

Now, repeat the exact same routine with 3996. Subtract the smallest arrangement (3699) from the largest (9963) to get 6264. Do it again with 6264: 6642 - 2466 = 4176. Finally, repeat with 4176: 7641 - 1467 = 6174.

Here is the mind-blowing part: once you reach 6174, doing the calculation again gives 7641 - 1467 = 6174. You are trapped in 6174 forever. No matter which four-digit number you start with, you will always arrive at this exact number in seven steps or fewer.

Numbers swirling into Kaprekar's constant 6174 Start with any 4-digit num 2024 9876 1234 8520 6174 Kaprekar cnst Reaches within max 7 steps

The Math Behind It: How and Why It Works

An Indian mathematician named D. R. Kaprekar discovered this fascinating quirk in 1949. The process of rearranging digits, subtracting, and feeding the result back into the formula is known as the 'Kaprekar routine.'

In mathematics, a value that returns to itself after a specific operation is called a 'fixed point' or an 'attractor.' In the world of four-digit numbers, 6174 acts as the sole fixed point. It works like a ball rolling down a funnelβ€”no matter where you drop it, it always settles at the very bottom.

There is only one exception: numbers with four identical digits, such as 1111 or 7777. Because their largest and smallest arrangements are identical, subtracting them immediately results in 0. Aside from those repdigits, any four-digit number with at least two distinct digits will work.

Do Other Digit Lengths Have Magic Numbers Too?

What happens if you try this same rule with three-digit numbers? Let's test 523. Subtracting the smallest arrangement (235) from the largest (532) gives 297. Next, 972 - 279 = 693, then 963 - 369 = 594, and finally 954 - 459 = 495.

Once you reach 495, the calculation halts because 954 - 459 = 495. This means 495 is the Kaprekar constant for three-digit numbers. Any valid three-digit number converges to 495 within six steps.

However, not every digit length produces a single fixed number. Two-digit and five-digit numbers get trapped in repeating cycles of multiple numbers instead of stopping at one. The fact that four-digit numbers cleanly collapse into a single number like 6174 is a rare and elegant mathematical coincidence.

Kaprekar Routine: 3-Digit vs 4-Digit Number Comparison 3 digits 523 297 693 594 495 Fixed 4 digits 2024 3996 6264 4176 6174 Fixed

πŸ€” Common misconceptions

βœ• Myth

Every four-digit number, including 1111 or 2222, turns into 6174.

βœ“ Fact

Numbers with four identical digits immediately result in 0 when subtracted, so they never reach 6174. The routine requires at least two distinct digits.

🧺 Where you meet it

1 Starting with 1234: 4321 - 1234 = 3087 -> 8730 - 0378 = 8352 -> 8532 - 2358 = 6174. It reaches 6174 in just 3 steps.
2 Starting with the three-digit number 100: 100 - 001 = 099 -> 990 - 099 = 891 -> 981 - 189 = 792 -> 972 - 279 = 693 -> 963 - 369 = 594 -> 954 - 459 = 495. It reaches 495 in 6 steps.
πŸ’‘ In one sentence

By repeatedly subtracting the smallest arrangement of digits from the largest, any valid four-digit number will always collapse into 6174 within at most seven steps.