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.

A343677 Number of (2n+1)-digit undulating alternating palindromic primes.

This page as a plain text file.
%I A343677 #23 Sep 03 2021 20:36:37
%S A343677 4,6,19,34,100,241,697,1779,6590,16585,57237,179291,591325,1707010,
%T A343677 6520756,18271423,65212230,210339179,706823539
%N A343677 Number of (2n+1)-digit undulating alternating palindromic primes.
%C A343677 a(n) is the number of (2n+1)-digit terms in A343675.
%C A343677 a(n) <= A057332(n).
%o A343677 (Python)
%o A343677 from sympy import isprime
%o A343677 def f(w):
%o A343677     for s in w:
%o A343677         for t in range(int(s[-1])+1,10,2):
%o A343677             yield s+str(t)
%o A343677 def g(w):
%o A343677     for s in w:
%o A343677         for t in range(1-int(s[-1])%2,int(s[-1]),2):
%o A343677             yield s+str(t)
%o A343677 def A343677(n):
%o A343677     if n == 0:
%o A343677         return 4
%o A343677     c = 0
%o A343677     for d in '1379':
%o A343677         x = d
%o A343677         for i in range(1,n+1):
%o A343677             x = g(x) if i % 2 else f(x)
%o A343677         c += sum(1 for p in x if isprime(int(p+p[-2::-1])))
%o A343677         y = d
%o A343677         for i in range(1,n+1):
%o A343677             y = f(y) if i % 2 else g(y)
%o A343677         c += sum(1 for p in y if isprime(int(p+p[-2::-1])))
%o A343677     return c
%Y A343677 Cf. A002385, A030144, A057332, A059168, A343590.
%K A343677 nonn,base,more
%O A343677 0,1
%A A343677 _Chai Wah Wu_, Apr 25 2021
%E A343677 a(17)-a(18) from _Chai Wah Wu_, May 02 2021