A066711 RATS: Reverse Add Then Sort the digits applied to previous term, starting with 9.
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
Examples
668 -> 668 + 866 = 1534 -> 1345.
Links
- R. K. Guy, Conway's RATS and other reversals, Amer. Math. Monthly, 96 (1989), 425-428.
- J. Thiel, Conway’s RATS Sequences in Base 3, Journal of Integer Sequences, 15 (2012), #12.9.2. - _N. J. A. Sloane_, Jan 02 2013
- Eric Weisstein's World of Mathematics, RATS Sequence
- Index entries for linear recurrences with constant coefficients, signature (0,1).
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
Comments