6174
Kaprekar's constant.
Take any 4-digit number with at least two different digits. Leading zeros are allowed.
Arrange the digits first in descending and then in ascending order, when necessary with leading zeros.
Subtract the smaller number from the bigger one. Then apply the same procedure to the result.
After a limited number of steps you get a certain result which doesn't change any more: 6174 - ever!
This is Kaprekar's constant, named after the Indian mathematician D.R. Kaprekar (1905–1986),
who found this property 1949 first for 4-digit numbers.
Such constants exist for three-, four-, six-, eight-, nine- and ten-digit decimal numbers.
Example 2791:
9721 - 1279 = 8442
8442 - 2448 = 5994
9954 - 4599 = 5355
5553 - 3555 = 1998
9981 - 1899 = 8082
8820 - 0288 = 8532
8532 - 2358 = 6174
7641 - 1467 = 6174
more interesting 4-digit numbers:
(background-color: #006174)