6174 is known as Kaprekar's constant.
Take any four-digit number, using at least two different digits. (Leading zeros are allowed.)Arrange the digits in descending and then in ascending order to get two four-digit numbers, adding leading zeros if necessary.Subtract the smaller number from the bigger number.Go back to step 2 and repeat.The above process will always yield 6174, in at most 7 iterations. The only four-digit numbers for which Kaprekar's routine does not reach 6174 are repdigits such as 1111, which give the result 0000 after a single iteration.