This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A151967 #5 Mar 30 2012 17:28:42 %S A151967 0,0,6174,62964,420876,7509843,64308654,864197532,6431088654, %T A151967 86420987532,643310886654,8643209876532,43333208766666, %U A151967 885432098765412,6543331088666544,88754320987654212,643111110888888654 %N A151967 Iterate the Kaprekar map of A151949 starting at the n-digit number 100...01; sequence gives the lowest number in the resulting cycle. %H A151967 Joseph Myers, <a href="/A151967/b151967.txt">Table of n, a(n) for n=2..1000</a> [From _Joseph Myers_, Aug 21 2009] %H A151967 <a href="/index/K#Kaprekar_map">Index entries for the Kaprekar map</a> %e A151967 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. %t A151967 (Mma program from Harvey P. Dale) To find the first 20 terms of the trajectory of 10001, for instance: %t A151967 f[n_]:=Module[{idn=IntegerDigits[n],idns},idns=Sort[idn];Abs[FromDigits[ idns]-FromDigits[Reverse[idns]]]] %t A151967 NestList[f,10001,20] %Y A151967 See A151968 for the length of the cycles. Cf. A151957, A151958. %Y A151967 Different from A151957. %K A151967 nonn,base %O A151967 2,3 %A A151967 _N. J. A. Sloane_, Aug 20 2009 %E A151967 Extended by _Joseph Myers_, Aug 21 2009