Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A151957
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A151957 Iterate the Kaprekar map of A151949 starting at the n-digit number 100...02; sequence gives the lowest number in the resulting cycle. +0
5
0, 495, 6174, 62964, 420876, 7509843, 64308654, 753098643, 6431088654, 86420987532, 643330866654, 8764209875322, 64333308666654, 885432098765412, 6543331088666544, 88543320987665412, 975533110888664421 (list; graph; listen)
OFFSET

2,2

LINKS

Joseph Myers, Table of n, a(n) for n=2..1000 [From Joseph Myers (jsm(AT)polyomino.org.uk), Aug 21 2009]

Index entries for the Kaprekar map

MAPLE

Maple program from R. J. Mathar, Aug 20 2009

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:

A151957 := proc(n)

local tra, x ;

x := 10^(n-1)+2 ;

tra := [x] ;

while true do

x := A151949(x) ;

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

op(l..nops(tra), tra) ;

RETURN(min(%)) ;

fi;

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

od:

end:

seq(A151957(n), n=2..60) ;

MATHEMATICA

To find the first 20 terms of the trajectory of 10002, for instance:

f[n_]:=Module[{idn=IntegerDigits[n], idns}, idns=Sort[idn]; Abs[FromDigits[ idns]-FromDigits[Reverse[idns]]]]

NestList[f, 10002, 20]

CROSSREFS

See A151958 for the length of the cycles. Cf. A151949, A151955 (the trajectory of 102), A151956 (the trajectory of 1002).

See also A151967, A151968.

Sequence in context: A164716 A164718 A151965 this_sequence A099009 A055160 A055157

Adjacent sequences: A151954 A151955 A151956 this_sequence A151958 A151959 A151960

KEYWORD

nonn,base

AUTHOR

Harvey P. Dale (hpd1(AT)nyu.edu) and N. J. A. Sloane (njas(AT)research.att.com), Aug 18 2009, Aug 19 2009

EXTENSIONS

Extended by R. J. Mathar and Joseph Myers (jsm(AT)polyomino.org.uk), 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 November 29 12:46 EST 2009. Contains 167659 sequences.


AT&T Labs Research