cp's OEIS Frontend

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.

Showing 1-2 of 2 results.

A151957 Iterate the Kaprekar map of A151949 starting at the n-digit number 100...02; sequence gives the lowest number in the resulting cycle.

Original entry on oeis.org

0, 495, 6174, 62964, 420876, 7509843, 64308654, 753098643, 6431088654, 86420987532, 643330866654, 8764209875322, 64333308666654, 885432098765412, 6543331088666544, 88543320987665412, 975533110888664421
Offset: 2

Views

Author

Harvey P. Dale and N. J. A. Sloane, Aug 18 2009, Aug 19 2009

Keywords

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.

Programs

  • Maple
    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) ;
    # R. J. Mathar, Aug 20 2009
  • 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]

Extensions

Extended by R. J. Mathar and Joseph Myers, Aug 20 2009

A151946 a(1) = 8127; thereafter a(n) = (a(n-1) with digits sorted into descending order) - (a(n-1) with digits sorted into ascending order) (see the Kaprekar map, A151949).

Original entry on oeis.org

8127, 7443, 3996, 6264, 4176, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174
Offset: 1

Views

Author

N. J. A. Sloane, Aug 18 2009

Keywords

Comments

Similar in spirit to the RATS (Reverse, Add Then Sort) sequences.
Converges to the fixed point 6174. For the list of fixed points see A099009.
The initial value 1001 is the smallest number that converges to 6174 - see A151967.

Crossrefs

Showing 1-2 of 2 results.