The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A151962 Length of preperiodic part of trajectory of n under iteration of the Kaprekar map in A151949. 11

%I #9 Mar 16 2019 02:24:45

%S 0,1,1,1,1,1,1,1,1,1,2,1,2,6,4,5,3,3,5,4,6,2,1,2,6,4,5,3,3,5,4,6,2,1,

%T 2,6,4,5,3,3,5,4,6,2,1,2,6,4,5,3,3,5,4,6,2,1,2,6,4,5,3,3,5,4,6,2,1,2,

%U 6,4,5,3,3,5,4,6,2,1,2,6,4,5,3,3,5,4,6,2,1,2,6,4,5,3,3,5,4,6,2

%N Length of preperiodic part of trajectory of n under iteration of the Kaprekar map in A151949.

%H Joseph Myers, <a href="/A151962/b151962.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/K#Kaprekar_map">Index entries for the Kaprekar map</a>

%e 13 -> 18 -> 63 -> 27 -> 45 -> 9 -> 0 -> 0, so a(13)=6.

%p A151949 := proc(n)

%p local tup;

%p tup := sort(convert(n,base,10)) ;

%p add( (op(i,tup)-op(-i,tup)) *10^(i-1),i=1..nops(tup)) :

%p end:

%p A151962 := proc(n)

%p local tra,x ;

%p tra := [n] ;

%p x := n ;

%p while true do

%p x := A151949(x) ;

%p if member(x,tra,'l') then

%p RETURN(l-1) ;

%p fi;

%p tra := [op(tra),x] :

%p od:

%p end:

%p seq(A151962(n),n=0..120) ;

%p # _R. J. Mathar_, Aug 20 2009

%Y Cf. A151949, A151963. Strictly different from A072137.

%Y In other bases: A164885 (base 2), A164995 (base 3), A165014 (base 4), A165034 (base 5), A165053 (base 6), A165073 (base 7), A165092 (base 8), A165112 (base 9). - _Joseph Myers_, Sep 05 2009

%K nonn,base

%O 0,11

%A _N. J. A. Sloane_, Aug 19 2009

%E More terms from _R. J. Mathar_, Aug 20 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 20 01:45 EDT 2024. Contains 372703 sequences. (Running on oeis4.)