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.

A345112 a(n) is the number of steps to reach a palindrome > n 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 A345112 #6 Jun 09 2021 23:22:42
%S A345112 1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,
%T A345112 1,1,3,1,19,1,1,1,1,1,1,3,1,19
%N A345112 a(n) is the number of steps to reach a palindrome > n under repeated applications of the map x -> A345111(x) starting with n, or 0 if no palindrome is ever reached.
%C A345112 Is a(49) = 0? If a(49) != 0, it is > 100000 (10^5) (see A345115).
%e A345112 For n = 39: The trajectory of 39 under the given map starts 39, 132, 453, 987, 1866, 10527, 15798, 73779, 111576, 227337, 500709, 507804, 585849, 1444344, 5887785, 14765640, 62422041, 86642457, 153067035, 683737386, reaching the palindrome 683737386 after 19 iterations, so a(39) = 19.
%o A345112 (PARI) eva(n) = subst(Pol(n), x, 10)
%o A345112 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 A345112 a(n) = my(x=n, i=0); while(1, x=x+eva(rot(digits(x))); i++; if(digits(x)==Vecrev(digits(x)), break)); i
%o A345112 (Python)
%o A345112 def pal(s): return s == s[::-1]
%o A345112 def rotl(s): return s[1:] + s[0]
%o A345112 def A345111(n): return n + int(rotl(str(n)))
%o A345112 def a(n):
%o A345112     i, iter, seen = 0, n, set()
%o A345112     while not (iter > n and pal(str(iter))) and iter not in seen:
%o A345112         seen.add(iter)
%o A345112         i, iter = i+1, A345111(iter)
%o A345112     return i if iter > n and pal(str(iter)) else 0
%o A345112 print([a(n) for n in range(1, 49)]) # _Michael S. Branicky_, Jun 09 2021
%Y A345112 Cf. A016016, A345110, A345111, A345113, A345114, A345115.
%K A345112 nonn,base,more
%O A345112 1,5
%A A345112 _Felix Fröhlich_, Jun 09 2021