OFFSET
1,1
COMMENTS
The terms of A358310 come in decreasing blocks; a(n) is the length of the n-th block.
EXAMPLE
For n = 1, there are three primes p with 1 < p < 10 such that 10-p is also prime, 3, 5, and 7, so a(1) = 3.
PROG
(PARI) a(n) = {if(n==1, return(3)); my(res=0, pow10=10^n); forprime(p=2, 10^(n-1), if(isprime(pow10-p), res++)); forprime(p=10^(n-1), pow10>>1, if(isprime(pow10-p), res+=2)); res} \\ David A. Corneth, Dec 17 2022
(Python)
from sympy import isprime, primerange
def a(n):
lb, ub = 10**(n-1), 10**n
s1 = sum(1 for p in primerange(1, lb) if isprime(ub-p))
s2 = sum(2 for p in primerange(lb, 5*lb) if isprime(ub-p))
return s1 + s2 + int(n == 1)
print([a(n) for n in range(1, 8)]) # Michael S. Branicky, Dec 17 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
N. J. A. Sloane, Dec 17 2022
EXTENSIONS
a(7)-a(9) from Michael S. Branicky, Dec 17 2022
a(10)-a(11) from David A. Corneth, Dec 17 2022
a(12) from N. J. A. Sloane, Dec 17 2022, found using Corneth's PARI program.
a(13) from Martin Ehrenstein, Dec 18 2022, found using Walisch's primesieve library.
STATUS
approved