- Take any four-digit number whose digits are not all identical.
(Let’s take 3141 as an example.) - Rearrange the string of digits to form the largest and smallest four digit numbers possible, padding it with leading zeroes if needed.
(We get 4311 as the largest number possible and 1134 as the smallest.) - Subtract the smaller number from the larger one.
(4311-1134 gives us 3177.) - With the result, repeat step 2 above.
(7731 - 1377 = 6354, 6543 - 3456 = 3087, 8730 - 0378 = 8352, 8532 - 2358 = 6174, 7641 - 1467 = 6174)
Within about seven steps, you’ll hit the number 6174. This works for any four digit number that doesn’t have repeated digits (like 8888 which will immediately give a zero after step 2). The magic number for three digit numbers is 495. This remarkable phenomenon was discovered by D. R. Kaprekar in 1949.





















