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.
%I A042938 #33 Jul 09 2018 12:15:01 %S A042938 1,3,9,27,72,216,612,1836,6381,19143,34191,102573,375201,1125603, %T A042938 3065211,9195633,27586899,99868572,299605716,617506992,1852520976, %U A042938 6790252581,20370757743,34775707302,104327121906,609121723401,1827365170203,3020715637281,9062146911843 %N A042938 Reverse or triple: if reverse(a(n)) > a(n), a(n+1) = reverse(a(n)), else a(n+1) = 3*a(n). %H A042938 Robert Israel, <a href="/A042938/b042938.txt">Table of n, a(n) for n = 1..1951</a> %e A042938 Starting with 1, the reverse is 1 and not greater than 1 so the next term is 3. The reverse of 3 is also not greater than 3 and so the next term is 9. The reverse of 9 is not greater than 9 and so the next term is 27. However, the reverse of 27 is 72 which is greater and so the next term in the sequence is 72 and so on. %p A042938 reverse:= proc(n) %p A042938 local L,i,m; %p A042938 L:= convert(n,base,10); %p A042938 m:= nops(L); %p A042938 add(L[i]*10^(m-i),i=1..m); %p A042938 end proc: %p A042938 a[1]:= 1: %p A042938 for n from 2 to 100 do %p A042938 r:= reverse(a[n-1]); %p A042938 if r > a[n-1] then a[n]:= r %p A042938 else a[n]:= 3*a[n-1] %p A042938 fi %p A042938 od: %p A042938 seq(a[i],i=1..100); # _Robert Israel_, Jun 24 2015 %t A042938 rd[n_]:=Module[{rev=FromDigits[Reverse[IntegerDigits[n]]]}, If[rev>n, rev, 3 n]]; NestList[rd, 1, 30] (* _Vincenzo Librandi_, Jun 24 2015 *) %t A042938 NestList[If[IntegerReverse[#]>#,IntegerReverse[#],3#]&,1,30] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jul 09 2018 *) %o A042938 (PARI) lista(nn) = {print1(a=1, ", "); for (n=2, nn, r = eval(concat(Vecrev(Str(a)))); if (r > a, a = r, a *= 3); print1(a, ", "););} \\ _Michel Marcus_, Jan 31 2016 %K A042938 base,nonn %O A042938 1,2 %A A042938 _Dann Toliver_ %E A042938 Corrected by _Robert Israel_, Jun 24 2015