login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004000 RATS: Reverse Add Then Sort the digits applied to previous term, starting with 1.
(Formerly M1137)
19

%I M1137 #61 Feb 21 2023 07:33:42

%S 1,2,4,8,16,77,145,668,1345,6677,13444,55778,133345,666677,1333444,

%T 5567777,12333445,66666677,133333444,556667777,1233334444,5566667777,

%U 12333334444,55666667777,123333334444,556666667777,1233333334444,5566666667777,12333333334444

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

%C 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.

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

%H Alois P. Heinz, <a href="/A004000/b004000.txt">Table of n, a(n) for n = 1..2002</a> (first 200 terms from T. D. Noe)

%H R. K. Guy, <a href="http://www.jstor.org/stable/2325149">Conway's RATS and other reversals</a>, Amer. Math. Monthly, 96 (1989), 425-428.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/RATSSequence.html">RATS Sequence</a>.

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

%F a(n+1) = A036839(a(n)). - _Reinhard Zumkeller_, Mar 14 2012

%F A010888(a(n)) = A153130(n-1). - _Ivan N. Ianakiev_, Nov 27 2014

%F 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

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

%p 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;

%t NestList[FromDigits[Sort[IntegerDigits[#+FromDigits[Reverse[ IntegerDigits[#]]]]]]&,1,30] (* _Harvey P. Dale_, Nov 29 2011 *)

%o (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

%o (Haskell)

%o a004000_list = iterate a036839 1 -- _Reinhard Zumkeller_, Mar 14 2012

%o (PARI) step(n)=fromdigits(vecsort(digits(n+fromdigits(Vecrev(digits(n)))))) \\ _Charles R Greathouse IV_, Jun 23 2017

%o (Python)

%o l = [0, 1]

%o for n in range(2, 51):

%o x = str(l[n - 1])

%o l.append(int(''.join(sorted(str(int(x) + int(x[::-1]))))))

%o print(l[1:]) # _Indranil Ghosh_, Jul 05 2017

%Y Cf. A036839, A066710, A066711, A066713, A164338, A161593, A114611, A114612, A209878, A209879, A209880.

%K base,nonn,nice,easy

%O 1,2

%A _N. J. A. Sloane_

%E Entry revised by _N. J. A. Sloane_, Jan 19 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 06:44 EDT 2024. Contains 371782 sequences. (Running on oeis4.)