[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A343677
Number of (2n+1)-digit undulating alternating palindromic primes.
1
4, 6, 19, 34, 100, 241, 697, 1779, 6590, 16585, 57237, 179291, 591325, 1707010, 6520756, 18271423, 65212230, 210339179, 706823539
OFFSET
0,1
COMMENTS
a(n) is the number of (2n+1)-digit terms in A343675.
a(n) <= A057332(n).
PROG
(Python)
from sympy import isprime
def f(w):
for s in w:
for t in range(int(s[-1])+1, 10, 2):
yield s+str(t)
def g(w):
for s in w:
for t in range(1-int(s[-1])%2, int(s[-1]), 2):
yield s+str(t)
def A343677(n):
if n == 0:
return 4
c = 0
for d in '1379':
x = d
for i in range(1, n+1):
x = g(x) if i % 2 else f(x)
c += sum(1 for p in x if isprime(int(p+p[-2::-1])))
y = d
for i in range(1, n+1):
y = f(y) if i % 2 else g(y)
c += sum(1 for p in y if isprime(int(p+p[-2::-1])))
return c
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Chai Wah Wu, Apr 25 2021
EXTENSIONS
a(17)-a(18) from Chai Wah Wu, May 02 2021
STATUS
approved