Information

The Kaprekar operation

The Kaprekar operation

There is a curious mathematical operation called Kaprekar Operation that is somewhat unique.

It consists in rearranging the digits of a number so that the largest and smallest possible number is obtained, then subtracting the smallest from the largest.

This operation can be applied to numbers of any size and can be repeated over and over again on the result obtained. It is interesting to observe what happens with numbers that have exactly four figures, provided they are not all the same. The result of applying the Kaprekar operation (up to a maximum of 8 times) on any four-digit number that is not all the same is always the same magic number.

Can you find what it is?

Keep in mind that if numbers of less than four digits appear during the operation, just fill them with leading zeros.

Solution

You always reach the number 6174 (which is called Kaprekar constant).

You can find more information on Wikipedia