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.

A004000 RATS: Reverse Add Then Sort the digits applied to previous term, starting with 1.

Original entry on oeis.org

1, 2, 4, 8, 16, 77, 145, 668, 1345, 6677, 13444, 55778, 133345, 666677, 1333444, 5567777, 12333445, 66666677, 133333444, 556667777, 1233334444, 5566667777, 12333334444, 55666667777, 123333334444, 556666667777, 1233333334444, 5566666667777, 12333333334444
Offset: 1

Views

Author

Keywords

Comments

It is conjectured that no matter what the starting term is, repeatedly applying RATS leads either to this sequence or into a cycle of finite length, such as those in A066710 and A066711.

Examples

			668 -> 668 + 866 = 1534 -> 1345.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a004000_list = iterate a036839 1  -- Reinhard Zumkeller, Mar 14 2012
    
  • Magma
    [ n eq 1 select 1 else Seqint(Reverse(Sort(Intseq(p + Seqint(Reverse(Intseq(p))) where p is Self(n-1))))) : n in [1..10]]; // Sergei Haller (sergei(AT)sergei-haller.de), Dec 21 20061
    
  • Maple
    read transforms; RATS := n -> digsort(n + digrev(n)); b := [1]; t := [1]; for n from 1 to 50 do t := RATS(t); b := [op(b),t]; od: b;
  • Mathematica
    NestList[FromDigits[Sort[IntegerDigits[#+FromDigits[Reverse[ IntegerDigits[#]]]]]]&,1,30] (* Harvey P. Dale, Nov 29 2011 *)
  • PARI
    step(n)=fromdigits(vecsort(digits(n+fromdigits(Vecrev(digits(n)))))) \\ Charles R Greathouse IV, Jun 23 2017
    
  • Python
    l = [0, 1]
    for n in range(2, 51):
        x = str(l[n - 1])
        l.append(int(''.join(sorted(str(int(x) + int(x[::-1]))))))
    print(l[1:]) # Indranil Ghosh, Jul 05 2017

Formula

Let a(n) = k, form m by Reversing the digits of k, Add m to k Then Sort the digits of the sum into increasing order to get a(n+1).
a(n+1) = A036839(a(n)). - Reinhard Zumkeller, Mar 14 2012
A010888(a(n)) = A153130(n-1). - Ivan N. Ianakiev, Nov 27 2014
a(2n-1) = (37 * 10^(n-3) + 3332)/3, n >= 11; a(2n) = (167 * 10^(n-3) + 3331)/3, n >= 10. - Jianing Song, May 06 2021

Extensions

Entry revised by N. J. A. Sloane, Jan 19 2002