The number 6174 is a really mysterious number. At first glance, it might not seem so obvious. But as we are about to see, anyone who can subtract can uncover the mystery that makes 6174 so special.
Kaprekar's operationIn 1949 the mathematician D. R. Kaprekar from Devlali, India, devised a process now known as Kaprekar's operation. First choose a four digit number where the digits are not all the same (that is not 1111, 2222,...). Then rearrange the digits to get the largest and smallest numbers these digits can make. Finally, subtract the smallest number from the largest to get a new number, and carry on repeating the operation for each new number.
It is a simple operation, but Kaprekar discovered it led to a surprising result. Let's try it out, starting with the number 2005, the digits of last year. The maximum number we can make with these digits is 5200, and the minimum is 0025 or 25 (if one or more of the digits is zero, embed these in the left hand side of the minimum number). The subtractions are:
5200 - 0025 = 5175
7551 - 1557 = 5994
9954 - 4599 = 5355
5553 - 3555 = 1998
9981 - 1899 = 8082
8820 - 0288 = 8532
8532 - 2358 = 6174
7641 - 1467 = 6174
When we reach 6174 the operation repeats itself, returning 6174 every time. We call the number 6174 a kernel of this operation. So 6174 is a kernel for Kaprekar's operation, but is this as special as 6174 gets? Well not only is 6174 the only kernel for the operation, it also has one more surprise up it's sleeve. Let's try again starting with a different number, say 1789.
9871 - 1789 = 8082
8820 - 0288 = 8532
8532 - 2358 = 6174
We reached 6174 again!
When we started with 2005 the process reached 6174 in seven steps, and for 1789 in three steps. In fact, you reach 6174 for all four digit numbers that don't have all the digits the same. It's marvellous, isn't it? Kaprekar's operation is so simple but uncovers such an interesting result. And this will become even more intriguing when we think about the reason why all four digit numbers reach this mysterious number 6174.
Only 6174?
The digits of any four digit number can be arranged into a maximum number by putting the digits in descending order, and a minimum number by putting them in ascending order. So for four digits a,b,c,d where
9 ≥ a ≥ b ≥ c ≥ d ≥ 0
and a, b, c, d are not all the same digit, the maximum number is abcd and the minimum is dcba.
We can calculate the result of Kaprekar's operation using the standard method of subtraction applied to each column of this problem:
a b c d
- d c b a
A B C D
which gives the relations
D = 10 + d - a (as a > d)
C = 10 + c - 1 - b = 9 + c - b (as b > c - 1)
B = b - 1 - c (as b > c)
A = a - d
for those numbers where a>b>c>d.
A number will be repeated under Kaprekar's operation if the resulting number ABCD can be written using the initial four digits a,b,c and d. So we can find the kernels of Kaprekar's operation by considering all the possible combinations of {a, b, c, d} and checking if they satisfy the relations above. Each of the 4! = 24 combinations gives a system of four simultaneous equations with four unknowns, so we should be able to solve this system for a, b, c and d.
It turns out that only one of these combinations has integer solutions that satisfy 9 ≥ a ≥ b ≥ c ≥ d ≥ 0. That combination is ABCD = bdac, and the solution to the simultaneous equations is a=7, b=6, c=4 and d=1. That is ABCD = 6174. There are no valid solutions to the simultaneous equations resulting from some of the digits in {a,b,c,d} being equal. Therefore the number 6174 is the only number unchanged by Kaprekar's operation — our mysterious number is unique.
For three digit numbers the same phenomenon occurs. For example applying Kaprekar's operation to the three digit number 753 gives the following:
753 - 357 = 396
963 - 369 = 594
954 - 459 = 495
954 - 459 = 495
The number 495 is the unique kernel for the operation on three digit numbers, and all three digit numbers reach 495 using the operation. Why don't you check it yourself?