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.

A345113 a(n) is the palindrome reached after A345112(n) steps under repeated applications of the map x -> A345111(x), starting with n, or 0 if no palindrome is ever reached.

This page as a plain text file.
%I A345113 #6 Jun 09 2021 23:22:53
%S A345113 2,4,6,8,11,33,55,77,99,11,22,33,44,55,66,77,88,99,323,22,33,44,55,66,
%T A345113 77,88,99,323,121,33,44,55,66,77,88,99,323,121,683737386,44,55,66,77,
%U A345113 88,99,323,121,683737386
%N A345113 a(n) is the palindrome reached after A345112(n) steps under repeated applications of the map x -> A345111(x), starting with n, or 0 if no palindrome is ever reached.
%C A345113 First differs from A061563 at n = 19.
%e A345113 For n = 19: 19 + 91 = 110, 110 + 101 = 211, 211 + 112 = 323 and 323 is a palindrome, so a(19) = 323.
%o A345113 (PARI) eva(n) = subst(Pol(n), x, 10)
%o A345113 rot(vec) = if(#vec < 2, return(vec)); my(s=concat(Str(2), ".."), v=[]); s=concat(s, Str(#vec)); v=vecextract(vec, s); v=concat(v, vec[1]); v
%o A345113 a(n) = my(x=n); while(1, x=x+eva(rot(digits(x))); if(digits(x)==Vecrev(digits(x)), return(x)))
%o A345113 (Python)
%o A345113 def pal(s): return s == s[::-1]
%o A345113 def rotl(s): return s[1:] + s[0]
%o A345113 def A345111(n): return n + int(rotl(str(n)))
%o A345113 def a(n):
%o A345113     i, iter, seen = 0, n, set()
%o A345113     while not (iter > n and pal(str(iter))) and iter not in seen:
%o A345113         seen.add(iter)
%o A345113         i, iter = i+1, A345111(iter)
%o A345113     return iter if iter > n and pal(str(iter)) else 0
%o A345113 print([a(n) for n in range(1, 49)]) # _Michael S. Branicky_, Jun 09 2021
%Y A345113 Cf. A002113, A061563, A345110, A345111, A345112, A345114, A345115.
%K A345113 nonn,base,more
%O A345113 1,1
%A A345113 _Felix Fröhlich_, Jun 09 2021