6174
6174, also known as Kaprekar's constant, is a fixed point of a digit-rearrangement routine applied to four-digit numbers in base 10. It arises when, starting from any four-digit number that does not have all identical digits, one repeatedly forms two numbers from its digits—one in descending order and one in ascending order—subtracts the smaller from the larger, and repeats the process with the result.
The procedure is as follows: take a four-digit number with at least two distinct digits, arrange its
6174 was discovered by Indian mathematician D. R. Kaprekar in 1949 while studying these routines. It is