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.

A041013 Reverse or double: if reverse of a(n) > a(n), then a(n+1) = a(n) reversed, otherwise a(n+1) = 2*a(n).

This page as a plain text file.
%I A041013 #23 Aug 23 2023 19:49:48
%S A041013 1,2,4,8,16,61,122,221,442,884,1768,8671,17342,24371,48742,97484,
%T A041013 194968,869491,1738982,2898371,5796742,11593484,48439511,96879022,
%U A041013 193758044,440857391,881714782,1763429564,4659243671,9318487342,18636974684,48647963681
%N A041013 Reverse or double: if reverse of a(n) > a(n), then a(n+1) = a(n) reversed, otherwise a(n+1) = 2*a(n).
%H A041013 Reinhard Zumkeller, <a href="/A041013/b041013.txt">Table of n, a(n) for n = 0..1000</a>
%t A041013 rd[n_]:=Module[{rev=FromDigits[Reverse[IntegerDigits[n]]]},If[ rev>n, rev, 2n]]; NestList[rd,1,40] (* _Harvey P. Dale_, Jan 25 2013 *)
%t A041013 NestList[If[IntegerReverse[#]>#,IntegerReverse[#],2#]&,1,40] (* _Harvey P. Dale_, Aug 23 2023 *)
%o A041013 (Haskell)
%o A041013 a041013 n = a041013_list !! n
%o A041013 a041013_list = 1 : f 1 where
%o A041013    f x | rev <= x  = (2*x) : f (2*x)
%o A041013        | otherwise = rev : f rev where rev = a004086 x
%o A041013 -- _Reinhard Zumkeller_, Aug 08 2011
%Y A041013 Cf. A004086.
%K A041013 base,nonn,nice
%O A041013 0,2
%A A041013 _Dann Toliver_
%E A041013 Typo in definition corrected by K. Viswanathan Iyer, Mar 23 2010