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-6 of 6 results.

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

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

Original entry on oeis.org

9, 18, 99, 189, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117, 288, 117
Offset: 1

Views

Author

N. J. A. Sloane, Jan 19 2002

Keywords

Comments

a(1) = A114612(1) = 9; A114611(3) = 2. - Reinhard Zumkeller, Mar 14 2012

Examples

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

Crossrefs

Programs

  • Haskell
    a066711_list = iterate a036839 9  -- Reinhard Zumkeller, Mar 14 2012
    
  • Mathematica
    NestList[ FromDigits[ Sort[ IntegerDigits[# + FromDigits[ Reverse[ IntegerDigits[#]]]]]] &, 9, 48] (* Jayanta Basu, Aug 13 2013 *)
    Join[{9, 18, 99, 189},LinearRecurrence[{0, 1},{117, 288},45]] (* Ray Chandler, Aug 25 2015 *)
  • Python
    from itertools import accumulate
    def rats(anm1, _):
        return int("".join(sorted(str(anm1 + int(str(anm1)[::-1])))))
    print(list(accumulate([9]*49, rats))) # Michael S. Branicky, Sep 18 2021

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).
Periodic with period 2.
a(n+1) = A036839(a(n)). - Reinhard Zumkeller, Mar 14 2012
G.f.: x*(-99*x^5 - 18*x^4 - 171*x^3 - 90*x^2 - 18*x - 9)/(x^2 - 1). - Chai Wah Wu, Feb 07 2020

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

Original entry on oeis.org

3, 6, 12, 33, 66, 123, 444, 888, 1677, 3489, 12333, 44556, 111, 222, 444, 888, 1677, 3489, 12333, 44556, 111, 222, 444, 888, 1677, 3489, 12333, 44556, 111, 222, 444, 888, 1677, 3489, 12333, 44556, 111, 222, 444, 888, 1677, 3489, 12333
Offset: 1

Views

Author

N. J. A. Sloane, Jan 19 2002

Keywords

Comments

a(1) = A114614(1) = 3; A114611(3) = 8. [Reinhard Zumkeller, Mar 14 2012]

Examples

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

Crossrefs

Programs

  • Haskell
    a066710_list = iterate a036839 3  -- Reinhard Zumkeller, Mar 14 2012
  • Mathematica
    f[k_] := Module[{m = FromDigits[Reverse[IntegerDigits[k]]]}, FromDigits[ Sort[ IntegerDigits[k + m]]]]; NestList[f, 3, 50] (* Harvey P. Dale, Jan 18 2011 *)

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).
Periodic with period 8.
a(n+1) = A036839(a(n)). [Reinhard Zumkeller, Mar 14 2012]
From Chai Wah Wu, Feb 07 2020: (Start)
a(n) = a(n-8) for n > 14.
G.f.: x*(-99*x^13 - 45*x^12 - 44523*x^11 - 12321*x^10 - 3483*x^9 - 1674*x^8 - 888*x^7 - 444*x^6 - 123*x^5 - 66*x^4 - 33*x^3 - 12*x^2 - 6*x - 3)/(x^8 - 1). (End)

A114616 Starting numbers for which the RATS sequence has eventual period 18.

Original entry on oeis.org

29, 38, 47, 49, 56, 58, 65, 67, 74, 76, 83, 85, 92, 94, 110, 112, 118, 134, 137, 140, 142, 154, 155, 181, 187, 196, 209, 211, 217, 229, 233, 236, 239, 241, 253, 254, 259, 280, 286, 295, 299, 308, 310, 316, 319, 328, 329, 332, 335, 338, 340, 352, 353, 358
Offset: 1

Views

Author

Eric W. Weisstein, Dec 16 2005

Keywords

Comments

A114611(a(n)) = 18. - Reinhard Zumkeller, Mar 14 2012

Crossrefs

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

Original entry on oeis.org

20169, 111267, 337788, 1122255, 4446666, 1111113, 2222244, 4446666, 1111113, 2222244, 4446666, 1111113, 2222244, 4446666, 1111113, 2222244, 4446666, 1111113, 2222244, 4446666, 1111113, 2222244, 4446666, 1111113, 2222244, 4446666, 1111113, 2222244, 4446666
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 14 2012

Keywords

Comments

A114613(1) = 20169 is the smallest starting number for a RATS trajectory leading to a cycle of length 3: A114611(20169) = 3;
a(n + 3) = a(n) for n > 4.

Crossrefs

Programs

  • Haskell
    a209878 n = a209878_list !! (n-1)
    a209878_list = iterate a036839 20169
  • Mathematica
    Join[{20169, 111267, 337788, 1122255},LinearRecurrence[{0, 0, 1},{4446666, 1111113, 2222244},25]] (* Ray Chandler, Aug 25 2015 *)

Formula

a(n + 1) = A036839(a(n)).

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

Original entry on oeis.org

6999, 15699, 11355, 66666, 123333, 445566, 111111, 222222, 444444, 888888, 1677777, 3455589, 11112333, 33444444, 77778888, 156666666, 123333378, 666669999, 1356666666, 123333789, 11111667, 22777788, 11115555, 66666666, 123333333, 445566666, 111122223
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 14 2012

Keywords

Comments

A114615(1) = 6999 is the smallest starting number for a RATS trajectory leading to a cycle of length 14: A114611(6999) = 14;
a(n + 14) = a(n) for n > 25.

Crossrefs

Programs

  • Haskell
    a209879 n = a209879_list !! (n-1)
    a209879_list = iterate a036839 6999
  • Mathematica
    rats[n_]:=Module[{idnr=FromDigits[Reverse[IntegerDigits[n]]]}, FromDigits[ Sort[ IntegerDigits[idnr+n]]]]; NestList[rats,6999,30] (* Harvey P. Dale, May 29 2014 *)

Formula

a(n + 1) = A036839(a(n)).
Showing 1-6 of 6 results.