OFFSET
2,3
LINKS
Joseph Myers, Table of n, a(n) for n=2..1000 [From Joseph Myers, Aug 21 2009]
EXAMPLE
a(6) = 420876: 100001 -> 109989 -> 980811 -> 976221 -> 853542 -> 620874 -> 851742 -> 750843 -> 840852 -> 860832 -> 862632 -> 642654 -> 420876 -> 851742 -> ..., a cycle of length 7 with smallest member 420876.
MATHEMATICA
(Mma program from Harvey P. Dale) To find the first 20 terms of the trajectory of 10001, for instance:
f[n_]:=Module[{idn=IntegerDigits[n], idns}, idns=Sort[idn]; Abs[FromDigits[ idns]-FromDigits[Reverse[idns]]]]
NestList[f, 10001, 20]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Aug 20 2009
EXTENSIONS
Extended by Joseph Myers, Aug 21 2009
STATUS
approved