%I #33 Sep 06 2023 17:20:44
%S 9,18,99,189,117,288,117,288,117,288,117,288,117,288,117,288,117,288,
%T 117,288,117,288,117,288,117,288,117,288,117,288,117,288,117,288,117,
%U 288,117,288,117,288,117,288,117,288,117,288,117,288,117
%N RATS: Reverse Add Then Sort the digits applied to previous term, starting with 9.
%C a(1) = A114612(1) = 9; A114611(3) = 2. - _Reinhard Zumkeller_, Mar 14 2012
%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 J. Thiel, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL15/Thiel/thiel2.html">Conway’s RATS Sequences in Base 3</a>, Journal of Integer Sequences, 15 (2012), #12.9.2. - _N. J. A. Sloane_, Jan 02 2013
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/RATSSequence.html">RATS Sequence</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,1).
%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 Periodic with period 2.
%F a(n+1) = A036839(a(n)). - _Reinhard Zumkeller_, Mar 14 2012
%F 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
%e 668 -> 668 + 866 = 1534 -> 1345.
%t NestList[ FromDigits[ Sort[ IntegerDigits[# + FromDigits[ Reverse[ IntegerDigits[#]]]]]] &, 9, 48] (* _Jayanta Basu_, Aug 13 2013 *)
%t Join[{9, 18, 99, 189},LinearRecurrence[{0, 1},{117, 288},45]] (* _Ray Chandler_, Aug 25 2015 *)
%o (Haskell)
%o a066711_list = iterate a036839 9 -- _Reinhard Zumkeller_, Mar 14 2012
%o (Python)
%o from itertools import accumulate
%o def rats(anm1, _):
%o return int("".join(sorted(str(anm1 + int(str(anm1)[::-1])))))
%o print(list(accumulate([9]*49, rats))) # _Michael S. Branicky_, Sep 18 2021
%Y Cf. A004000, A036839, A066710, A033896, A114611, A114612.
%Y Cf. A004000, A066710, A209878, A209879, A209880.
%K nonn,base
%O 1,1
%A _N. J. A. Sloane_, Jan 19 2002