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-10 of 10 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

A114614 Starting numbers for which the RATS sequence has eventual period 8.

Original entry on oeis.org

3, 6, 12, 15, 21, 24, 30, 33, 39, 42, 48, 51, 57, 60, 66, 75, 84, 93, 102, 105, 111, 123, 129, 132, 138, 141, 147, 150, 159, 165, 168, 174, 177, 183, 186, 192, 195, 201, 204, 210, 219, 222, 228, 231, 237, 240, 246, 249, 258, 264, 267, 273, 276, 282, 285, 291
Offset: 1

Views

Author

Eric W. Weisstein, Dec 16 2005

Keywords

Comments

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

Crossrefs

A161593 Lengths of new periods in the RATS sequence (0 replacing infinity).

Original entry on oeis.org

0, 8, 2, 18, 2, 2, 2, 14, 2, 3, 2, 2, 2, 6
Offset: 1

Views

Author

J. H. Conway and Tanya Khovanova, Jun 14 2009

Keywords

Comments

The values A114611(j) for those starting values j of the RATS mapping x->A036839(x) which end in cycles that cannot be reached starting from any smaller j.
Every integer > 1 appears in this sequence. - Andrey Zabolotskiy, Jun 11 2017
For other terms see Branicky link. - Michael S. Branicky, Dec 30 2022

Examples

			a(1)=A114611(0). a(2)=A114611(j=3)=8 with a cycle of length 8 shown in A066710.
A114611(j=6)=8 does not contribute because the cycle is the same as reached from j=3.
a(3)=A114611(9)=2 with a new cycle of length 2 shown in A066711.
A114611(j=12)=8 does not contribute because the cycle is the same as reached from j=3.
A114611(j=15)=8 does not contribute because 15->66->123 is the cycle as reached from j=3.
A114611(j=18)=2 does not contribute because the cycle is the same as reached from j=9.
A114611(j=21)=8 does not contribute because 21->33->66 reaches the same cycle as started from j=3.
a(4)=A114611(j=29)=18.
		

Crossrefs

Extensions

Comment and examples added by R. J. Mathar, Jul 07 2009
a(9)-a(14) from Michael S. Branicky, Dec 30 2022

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)).

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

Original entry on oeis.org

29, 112, 233, 556, 1112, 2233, 5555, 1111, 2222, 4444, 8888, 16777, 34589, 112333, 444455, 889999, 1788899, 1177777, 4558889, 13444447, 77888888, 156667777, 233444489, 1112278888, 11999, 11119, 1223, 4444, 8888, 16777, 34589, 112333, 444455, 889999, 1788899
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 14 2012

Keywords

Comments

A114616(1) = 29 is the smallest starting number for a RATS trajectory leading to a cycle of length 18: A114611(29) = 18;
a(n + 18) = a(n) for n > 9.

Crossrefs

Programs

  • Haskell
    a209880 n = a209880_list !! (n-1)
    a209880_list = iterate a036839 29
  • Mathematica
    NestList[FromDigits[Sort[IntegerDigits[#+IntegerReverse[#]]]]&,29,40] (* or *) PadRight[{29,112,233,556,1112,2233,5555,1111,2222},50,{4558889,13444447,77888888,156667777,233444489,1112278888,11999,11119,1223,4444,8888,16777,34589,112333,444455,889999,1788899,1177777}] (* Harvey P. Dale, Sep 17 2018 *)

Formula

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

A161596 Numbers in cycles of RATS sequences.

Original entry on oeis.org

78, 111, 117, 156, 222, 288, 444, 888, 1223, 1677, 3489, 4444, 8888, 11119, 11127, 11667, 11999, 12333, 16777, 23388, 27888, 34589, 44556, 111177, 112333, 228888, 444455, 889999, 1111113, 1177777, 1788899, 2222244, 4446666, 4558889, 11144445, 13444447, 55556688
Offset: 1

Views

Author

J. H. Conway and Tanya Khovanova, Jun 14 2009

Keywords

Comments

The set of all numbers in any cycle of RATS sequences, sorted into natural order.
This implies that for any value a(j) in this sequence, A036839(a(j)) is again member of the sequence.
See Branicky link for larger terms. - Michael S. Branicky, Dec 30 2022

Examples

			The numbers 111, 222, 444, 888, 1677, 3489, 12333 and 44556 are in the sequence because they are in the cycle shown in A066710. The numbers 117 and 288 are in the cycle demonstrated in A066711.
The numbers 4444, 8888, 16777, 34589, 112333, 444455, ..., 1112278888, 11999, 1119, 1223 are in the cycle started at A161590(4). The numbers 11127 and 23388 are in the cycle started at A161590(7).
		

Crossrefs

Extensions

Descriptive comment and examples added by R. J. Mathar, Jul 08 2009
a(20) and beyond from Michael S. Branicky, Dec 30 2022

A161590 Initial value x of a RATS trajectory x->A036839(x) ending in a cycle unreachable by any smaller initial value.

Original entry on oeis.org

1, 3, 9, 29, 69, 2079, 3999, 6999, 10677, 20169, 10049598, 20008989, 100014888, 100074268
Offset: 1

Views

Author

J. H. Conway and Tanya Khovanova, Jun 14 2009, Jul 04 2009

Keywords

Comments

This is one way of book-keeping of new "destinies" (the smallest element of the cycle that the trajectory ends up in).
The value 1 is a placeholder for all non-cyclic trajectories.
Next terms are respectively <= 10000122228, 20000666679, 2000001113379, 2000001113559, 9999999999999, 100000044444447. See Branicky link for further upper bounds. - Michael S. Branicky, Dec 30 2022

Examples

			The RATS (Reverse Add Then Sort) algorithm applied to 69 produces a sequence 69, 156, 78, 156, 78, ...
Its cycle {156, 78} appears not if the algorithm is started with any number in the range 0 to 68, so 69 is added to the sequence.
		

Crossrefs

Extensions

10677, 20169 from Wouter Meeussen, Jul 04 2009
Definition rephrased by R. J. Mathar, Jul 08 2009
a(11)-a(14) from Michael S. Branicky, Dec 30 2022

A161592 Except for the first term the number in the sequence is the smallest number in a new cycle of a RATS sequence with a new destiny. The first term is the best analog of this for the "infinite cycle".

Original entry on oeis.org

12334444, 111, 117, 1223, 78, 111177, 11127, 11144445, 11667, 1111113
Offset: 1

Views

Author

J. H. Conway & Tanya Khovanova, Jun 14 2009

Keywords

Comments

"Destiny" means the smallest element of the cycle that the trajectory ends up in.
All seeds except those generating the cycles listed here produce an open non-cyclic family (thus without lowest element) but with a regular structure like 12334444, 55667777, 123334444, 556667777, 1233334444, 5566667777,..., and with an arbitrary start-up like 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, ... Notice that here we fall into the regular regime starting with 1233334444 (four threes). The sequence gives 12-(two threes)-4444 as a representative with index 1. - Wouter Meeussen, Jul 26 2009

Crossrefs

Extensions

11667, 1111113 from Wouter Meeussen, Jul 04 2009
Showing 1-10 of 10 results.