Kapreka's Constant is 6174. When you sort its digits once in ascending and once in descending order you get the numbers 1467 and 7641. Subtracting the smaller from the larger you get 7641-1467=6174, that's it's constant nature under this iteration rules.

What's more surprising: You can take almost any number between 1 and 9999 and get to 6174 just applying the iteration rules often enough.

Note: For numbers lower than 1000 add leading zeros, when sorting the digits those leading zeros will be trailing zeros, otherwise all start values 1-9 would end at 0 in the first step.

So to make it clear, starting with 1 means starting with 0001 and 1000, ending at 0999 after the first iteration, not at 1-1=0.

Iteration step; sort the 4 digit number you have (including leading 0s) ascending and descending. Subtract the smaller from the larger number you get this way and take this as next startnig point.

How many iterations will it need at max to get to Kaprekar's Constant 6174?

Iteration step; sort the 4 digit number you have (including leading 0s) ascending and descending. Subtract the smaller from the larger number you get this way and take this as next startnig point.

How many iterations will it need at max to get to Kaprekar's Constant 6174?