Generalized Kaprekar routine
online resourceposted on 06.12.2017, 00:00 by Noel Patson
This Demonstration shows fractal patterns in the number of steps required to reach a fixed point or cyclic behavior in an application of Kaprekar's routine applied to the natural numbers for different bases. To apply the Kaprekar routine for a positive integer greater than 1, arrange the digits of in base in descending () and ascending () order, compute (discarding any initial 0s). Repeating this procedure eventually leads to a cycle or a fixed point. The number of steps required, , plotted as a colored square at the position , produces beautiful fractal patterns. This Demonstration explores a subset of these patterns by allowing the setting of starting values and ranges for n and b.