| 
 | 
 | 
A routine discovered in 1949 by D. R. Kaprekar for 4-digit numbers, but which can be generalized to 
-digit numbers.  To
apply the Kaprekar routine to a number 
, arrange the digits in descending (
) and ascending (
) order.  Now compute
 and iterate.  The algorithm reaches 0 (a degenerate case), a constant, or a cycle, depending on the number
of digits in 
 and the value of 
.
For a 3-digit number 
 in base 10, the Kaprekar routine reaches the number 495 in at most six iterations. In base 
, there
is a unique number 
 to which 
 converges in at most 
 iterations Iff 
 is Even. For
any 4-digit number 
 in base-10, the routine terminates on the number 6174 after seven or fewer steps (where it enters the
1-cycle 
).
See also 196-Algorithm, Kaprekar Number, RATS Sequence
References
Eldridge, K. E. and Sagong, S.  ``The Determination of Kaprekar Convergence and Loop Convergence of All 3-Digit Numbers.''
  Amer. Math. Monthly 95, 105-112, 1988.
 
Kaprekar, D. R.  ``An Interesting Property of the Number 6174.''  Scripta Math. 15, 244-245, 1955.
 
Trigg, C. W.  ``All Three-Digit Integers Lead to...''  The Math. Teacher, 67, 41-45, 1974.
 
Young, A. L.  ``A Variation on the 2-digit Kaprekar Routine.''  Fibonacci Quart. 31, 138-145, 1993.
 
| 
 | 
 | 
© 1996-9 Eric W. Weisstein