Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A151963
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A151963 (Length of preperiodic part) + (length of cycle) of trajectory of n under iteration of the Kaprekar map in A151949. +0
10
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 3, 7, 5, 6, 4, 4, 6, 5, 7, 3, 2, 3, 7, 5, 6, 4, 4, 6, 5, 7, 3, 2, 3, 7, 5, 6, 4, 4, 6, 5, 7, 3, 2, 3, 7, 5, 6, 4, 4, 6, 5, 7, 3, 2, 3, 7, 5, 6, 4, 4, 6, 5, 7, 3, 2, 3, 7, 5, 6, 4, 4, 6, 5, 7, 3, 2, 3, 7, 5, 6, 4, 4, 6, 5, 7, 3, 2, 3, 7, 5, 6, 4, 4, 6, 5, 7, 3 (list; graph; listen)
OFFSET

0,2

COMMENT

Equals A151962(n) + 1 iff n < 10001 (when a cycle of length greater than 1 occurs for the first time).

LINKS

Joseph Myers and Robert G. Wilson v, (rgwv@rgwv.com), Table of n, a(n) for n = 0..1000 .

Index entries for the Kaprekar map

EXAMPLE

13->18->63->27->45->9->0->0, so a(13)=6+1 = 7.

MAPLE

Maple program from R. J. Mathar:

A151949 := proc(n)

local tup;

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

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

end:

A151963 := proc(n)

local tra, x ;

tra := [n] ;

x := n ;

while true do

x := A151949(x) ;

if x in tra then

RETURN(nops(tra)) ;

fi;

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

od:

end:

seq(A151963(n), n=0..120) ;

MATHEMATICA

f[n_] := Module[{idn = IntegerDigits@n, idns}, idns = Sort@ idn; FromDigits@ Reverse@ idns - FromDigits@ idns]; g[n_] := Length[ NestWhileList[ f, n, UnsameQ, All]] - 1; Table[g@n, {n, 0, 104}] [From Robert G. Wilson v (rgwv(AT)rgwv.com), Aug 20 2009]

CROSSREFS

In other bases: A164886 (base 2), A164996 (base 3), A165015 (base 4), A165035 (base 5), A165054 (base 6), A165074 (base 7), A165093 (base 8), A165113 (base 9). [From Joseph Myers (jsm(AT)polyomino.org.uk), Sep 05 2009]

Sequence in context: A083311 A037968 A074908 this_sequence A111858 A111856 A111857

Adjacent sequences: A151960 A151961 A151962 this_sequence A151964 A151965 A151966

KEYWORD

nonn,base

AUTHOR

N. J. A. Sloane (njas(AT)research.att.com), Aug 19 2009

EXTENSIONS

Typos corrected by Joseph S. Myers, Aug 20 2009

More terms from R. J. Mathar and Robert G. Wilson v (rgwv(AT)rgwv.com), Aug 20 2009

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified December 16 17:18 EST 2009. Contains 170825 sequences.


AT&T Labs Research