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

A036839 RATS(n): Reverse Add Then Sort the digits.

Original entry on oeis.org

0, 2, 4, 6, 8, 1, 12, 14, 16, 18, 11, 22, 33, 44, 55, 66, 77, 88, 99, 11, 22, 33, 44, 55, 66, 77, 88, 99, 11, 112, 33, 44, 55, 66, 77, 88, 99, 11, 112, 123, 44, 55, 66, 77, 88, 99, 11, 112, 123, 134, 55, 66, 77, 88, 99, 11, 112, 123, 134, 145, 66, 77
Offset: 0

Views

Author

N. J. A. Sloane, Jan 19 2002

Keywords

Comments

a(n) = RATS(n), not RATS(a(n-1)).
Row 10 of A288535. - Andrey Zabolotskiy, Jun 14 2017

Examples

			1 -> 1 + 1 = 2, so a(1) = 2; 3 -> 3 + 3 = 6, so a(3) = 6.
		

Crossrefs

Programs

  • Haskell
    a036839 = a004185 . a056964  -- Reinhard Zumkeller, Mar 14 2012
    
  • Maple
    read transforms; RATS := n -> digsort(n + digrev(n));
  • Mathematica
    FromDigits[Sort[IntegerDigits[#+FromDigits[Reverse [IntegerDigits[#]]]]]] & /@Range[0,80]  (* Harvey P. Dale, Mar 26 2011 *)
  • Python
    def A036839(n):
        x = str(n+int(str(n)[::-1]))
        return int("".join(sorted(x))) # Indranil Ghosh, Jan 28 2017

Formula

Form m by Reversing the digits of n, Add m to n Then Sort the digits of the sum into increasing order to get a(n).
a(n) = A004185(A056964(n)). [Reinhard Zumkeller, Mar 14 2012]

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

A114611 Eventual period of the RATS sequence, where 0 indicates a divergent sequence.

Original entry on oeis.org

0, 0, 8, 0, 0, 8, 0, 0, 2, 0, 0, 8, 0, 0, 8, 0, 0, 2, 0, 0, 8, 0, 0, 8, 0, 0, 2, 0, 18, 8, 0, 0, 8, 0, 0, 2, 0, 18, 8, 0, 0, 8, 0, 0, 2, 0, 18, 8, 18, 0, 8, 0, 0, 2, 0, 18, 8, 18, 0, 8, 0, 0, 2, 0, 18, 8, 18, 0, 2, 0, 0, 2, 0, 18, 8, 18, 0, 2, 0, 0, 2, 0, 18, 8, 18, 0, 2, 0, 0, 2, 0, 18, 8, 18, 0, 2
Offset: 1

Views

Author

Eric W. Weisstein, Dec 16 2005

Keywords

Comments

a(A001651(n)) = 0; a(A114612(n)) = 2; a(A114613(n)) = 3; a(A114614(n)) = 8; a(A114615(n)) = 14; a(A114616(n)) = 18. - Reinhard Zumkeller, Mar 14 2012
Row 10 of A288537. - Andrey Zabolotskiy, Jun 14 2017

Crossrefs

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

A288537 Array A(b,n) by upward antidiagonals (b>1, n>0): the eventual period of the RATS sequence in base b starting from n; 0 is for infinity.

Original entry on oeis.org

1, 3, 1, 2, 3, 1, 2, 2, 3, 1, 8, 2, 2, 3, 1, 4, 8, 2, 2, 3, 1, 3, 4, 8, 2, 2, 3, 1, 2, 3, 2, 8, 2, 2, 3, 1, 0, 2, 3, 4, 2, 2, 2, 3, 1, 28, 0, 2, 3, 4, 8, 2, 2, 3, 1, 90, 28, 8, 2, 6, 2, 8, 2, 2, 3, 1, 8, 90, 28, 0, 2, 3, 4, 8, 2, 2, 3, 1, 72, 8, 90, 28, 0, 2
Offset: 2

Views

Author

Andrey Zabolotskiy, Jun 11 2017

Keywords

Comments

Eventual period of n under the mapping x->A288535(b,x), or 0 if there is a divergence and thus no eventual period.
For b = 3*2^m - 2 with m>1, row b contains all sufficiently large even integers if m is odd, or just all sufficiently large integers if m is even.
For b = 1 or 10 (mod 18) or b = 1 (mod (2^q-1)^2) with q>2, there are 0's in row b.
Conway conjectured that in row (base) 10, all 0's correspond to the same divergent RATS sequence called the Creeper (A164338). In Thiel's terms, it is quasiperiodic with quasiperiod 2, i.e., after every 2 steps the number of one of the digits (in this case, 3 or 6) increases by 1 while other digits stay unchanged. In other bases, 0's may correspond to different divergent RATS sequences. Thiel conjectured that the divergent RATS sequences are always quasiperiodic.

Examples

			In base 3, the RATS mapping acts as 1 -> 2 -> 4 (11 in base 3) -> 8 (22 in base 3) -> 13 (112 in base 3) -> 4, which has already been seen 3 steps ago, so A(3,1)=3.
The array begins:
1, 1, 1, 1, 1, 1, ...
3, 3, 3, 3, 3, 3, ...
2, 2, 2, 2, 2, 2, ...
2, 2, 2, 2, 2, 2, ...
8, 8, 8, 8, 2, 8, ...
4, 4, 2, 4, 4, 2, ...
3, 3, 3, 3, 6, 3, ...
2, 2, 2, 2, 2, 2, ...
0, 0, 8, 0, 0, 8, ...
28, 28, 28, 28, 2, 28, ...
90, 90, 90, 90, 90, 90 ...
		

Crossrefs

Cf. A004000, A036839, A114611 (row 10), A161593, A288535, A288536 (column 1).

Formula

A(2^t,1)=t.
A(3,3^A134067(p)-1)=p+3.

A164338 Conway's creeper sequence.

Original entry on oeis.org

12334444, 55667777, 123334444, 556667777, 1233334444, 5566667777, 12333334444, 55666667777, 123333334444, 556666667777, 1233333334444, 5566666667777, 12333333334444, 55666666667777, 123333333334444
Offset: 1

Views

Author

David W. Wilson, Aug 13 2009

Keywords

Comments

Trajectory of 12334444 under the RATS function A036839.
John Conway calls this sequence "the creeper" and conjectures that the RATS trajectory of every n >= 1 eventually enters a cycle or the creeper. David Wilson confirms this conjecture for n <= 10^10.
Continues with the obvious digital pattern.
Since a(n+2) = a(n) except for an added digit, this sequence can be described as a quasi-cycle of period 2 with smallest element 12334444. This is how it is treated in related sequences such as A161590, A161592 and A161593.

Crossrefs

Cf. A036839 (RATS function), A161590, A161592, A161593.

Programs

  • Haskell
    a164338 n = a164338_list !! (n-1)
    a164338_list = iterate a036839 12334444
    -- Reinhard Zumkeller, Mar 14 2012

Formula

a(n+2) = 10 a(n) - 9996 (n odd)
a(n+2) = 10 a(n) - 9993 (n even)
a(n+4) = 11 a(n+2) - 10 a(n)
a(n + 1) = A036839(a(n)). [Reinhard Zumkeller, Mar 14 2012]
G.f.: x*(-55677770*x^3 - 12344440*x^2 + 55667777*x + 12334444)/(10*x^4 - 11*x^2 + 1). - Chai Wah Wu, Feb 08 2020
Showing 1-7 of 7 results.