Discover the magic of 6174
Enter any four-digit number that has at least two different digits. The application will repeatedly subtract the smallest number formed by its digits from the largest, until it reaches the mysterious Kaprekar's constant: 6174.
Kaprekar's routine is a mathematical algorithm discovered by the Indian mathematician D. R. Kaprekar in 1949. For any four-digit number (where not all digits are the same), this process will always lead to the number 6174, which is known as Kaprekar's constant.
The process is as follows:
Amazingly, within a maximum of 7 steps, you will always arrive at the number 6174. Once you reach 6174, the process becomes a loop: 7641 - 1467 = 6174.