Definition of

Kaprekars Constant

Kaprekar's Constant is 6174

Take a 4-digit number (using at least two different digits) and then do these two steps around and around:
• Arrange the digits in descending order
• Subtract the number made from the digits in ascending order

and we will eventually end up with 6174

Example: 1525
5521 - 1255 = 4266
6642 - 2466 = 4176
7641 - 1467 = 6174

And 7641 - 1467 = 6174 again, so we have reached a stable value. This happens in at most 7 rounds.

The only numbers that don't work are fully repeated digits like 1111, 2222, etc as they become 0