Choose any four-digit number n>1000 whose digits are not all the same. Arrange its digits first in descending order, then in ascending order. Subtract the smaller number from the larger. (Keep zeros when rearranging digits and subtracting.)
Repeat this process with the differences you obtain. (Do not worry: no more than seven times.)
What did you get? That is right: 6174. After that, the number will keep repeating.
Example
Example: 5014.
5410-0145=5265.
6552-2556=3996.
9963-3699=6264.
6642-2466=4176.
7641-1467=6174.
This operation is called the Kaprekar function, K(n). The Indian mathematician Dattatreya Ramchandra Kaprekar announced this property of 6174 in 1949, and the number was named after him.
The definition gives K(6174)=6174. The number 6174 is called Kaprekar’s constant for four-digit numbers.
6174 is also a Harshad number — the word comes from the Sanskrit harṣa, “great joy” — meaning that it is divisible by the sum of its digits. Kaprekar also studied Harshad numbers.
