The Magic Number Of Kaprekar

Execute a structured sorting and subtraction algorithm to reach a constant.

d132ede3...
History

Kaprekar's Phenomenon

Introduce D.R. Kaprekar and his 1949 discovery.

The Mathematician Behind the Magic

D.R. Kaprekar was a mathematics teacher in a government school in Devl school in Devlali, Maharashtra. He loved playing with numbers and found many beautiful, previously unknown patterns.

1 / 2
f3ca7107...
Worked Example

Reaching 6174

Trace the algorithm for the number 6382.

Problem

Execute Kaprekar's routine starting with the 4-digit number 63826382.

1 / 5
63fc9ba4...
Diagram

The Magic Number of Kaprekar

Mathematician Kaprekar showing the flow chart for Kaprekar's constant in the classroom

A polished process flowchart showing the Kaprekar routine loop. Node 1: 'Take a 4-digit number'. Arrow points to Node 2: 'Let A = largest number formed from digits'. Arrow points to Node 3: 'Let B = smallest number formed from digits'. Arrow points to Node 4: 'Calculate C = A - B'. A looping arrow returns from C back to the start with the text 'Use digits of C'. The design features rounded card-style nodes, pastel gradient fills, elegant sans-serif typography, generous whitespace, subtle connecting arrows, light neutral background.
Click to zoom

The repetitive cycle of arranging and subtracting digits.

b206f0f8...
reading

The 3-Digit Magic Number

Apply the routine to a 3-digit number to find its constant.

0 of 3 blanks filled

Let's execute the steps to find the 3-digit Kaprekar constant starting from 321.

First, sort the digits of 321 in descending and ascending order, then subtract. The first step gives 321 - 123 = 198.

Using the result 198, the next step is 981 - 189 = 792. Continuing the process, the next subtraction is 972 - 279 = .

Taking that result, we calculate 963 - 369 = .

Eventually, this sequence will reach a number that starts repeating itself. The 3-digit Kaprekar constant that repeats is .

0b7606a4...
feedback

How Many Rounds?

Count the iterations for a specific number.

Goal: Use Kaprekar's routine starting with 5683.

In each round:

  1. Arrange the digits from largest to smallest to make the bigger number.
  2. Arrange the digits from smallest to largest to make the smaller number.
  3. Subtract: bigger number - smaller number.
  4. Repeat until you reach 6174.

Reminder: Always keep the number as 4 digits. If you get a 3-digit number, add a zero at the front before sorting again.

Make the biggest possible number using the digits 5, 6, 8, and 3.

Make the smallest possible 4-digit number using the same digits.

This gives the result of Round 1.

For each new number, arrange digits in descending and ascending order, then subtract.

Count how many subtractions were needed.