Kaprekar's constant, or 6174, is a constant that arises when we take a 4-digit integer, form the largest and smallest numbers from its digits, and then subtract these two numbers. Continuing with this process of forming and subtracting, we will always arrive at the number 6174. 6174 is known as Kaprekar's constant after the Indian mathematician D. R. Kaprekar. The above process, known as Kaprekar's routine, will always reach its fixed point, 6174, in at most 8 iterations. Once 6174 is reached, the process will continue yielding 7641 – 1467 = 6174.
What exactly is the logic behind this process? Is there any intuitive proof?