Kaprekar’s routine – Wikipedia
When a four-digit number is selected, Kaprekar’s algorithm is executed immediately and the sequence of numbers and the number of steps are output.

Kaprekar’s routine – Wikipedia
When a four-digit number is selected, Kaprekar’s algorithm is executed immediately and the sequence of numbers and the number of steps are output.