The Magic Number of Kaprekar
D.R. Kaprekar was a mathematics teacher in a government school in Devlali, Maharashtra. He liked playing with numbers very much and found many beautiful patterns in numbers that were previously unknown.
In 1949, he discovered a fascinating and magical phenomenon when playing with 4-digit numbers.

Let's see with an example?
Follow these steps and experience the magic for yourselves!
Pick any 4-digit number having at least two different digits, say 6382.

What happens if we continue doing this?

A = 6382 , B =
Take different 4-digit numbers and try carrying out these steps. Find out what happens. Check with your friends what they got.
You will always reach the magic number ‘6174’! The number ‘6174’ is now called the ‘Kaprekar constant’.
Carry out these same steps with a few 3-digit numbers. What number will start repeating?
Question: Take any four-digit number where all the digits are not the same (for example, 3524). Perform the Kaprekar process and find out how many steps it takes to reach 6174.
Solution:
Step 1: Arrange the digits in descending and ascending order: 5432 - 2345 =
Step 2: Repeat the process: 8730 - 0378 =
Step 3: Repeat the process: 8532 - 2358 =
It took