OFFSET
1,1
COMMENTS
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).
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
EXAMPLE
668 -> 668 + 866 = 1534 -> 1345.
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 *)
PROG
(Haskell)
a066711_list = iterate a036839 9 -- Reinhard Zumkeller, Mar 14 2012
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Jan 19 2002
STATUS
approved