Applying the Kaprekar routine to 4-digit number reaches 0 for exactly 77 4-digit numbers, while the remainder give 6174 in at most 8 iterations. The value 6174 is sometimes known as Kaprekar's constant (Deutsch and Goldman 2004).
Kaprekar's Constant
See also
Kaprekar Number, Kaprekar RoutineExplore with Wolfram|Alpha
References
Deutsch, D. and Goldman, B. "Kaprekar's Constant." Math. Teacher 98, 234-242, 2004.Cite this as:
Weisstein, Eric W. "Kaprekar's Constant." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/KaprekarsConstant.html