login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A040025 a(n) is the number of prime palindromes with 2n+1 digits. 2
4, 15, 93, 668, 5172, 42042, 353701, 3036643, 27045226, 239093865, 2158090933, 19742800564 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
LINKS
Shyam Sunder Gupta, Palindromic Primes up to 10^19.
Shyam Sunder Gupta, Palindromic Primes up to 10^21.
Shyam Sunder Gupta, Palindromic Primes up to 10^23.
EXAMPLE
a(1)=15 because Number of prime palindromes with 3 digits is 15. [Shyam Sunder Gupta, Mar 14 2009]
PROG
(PARI) a(n) = {my(nb = 0); forprime(p=10^(2*n), 10^(2*n+1)-1, if (eval(concat(Vecrev(Str(p)))) == p, nb++); ); nb; } \\ Michel Marcus, Jul 24 2015
(Python)
from sympy import isprime
from itertools import product
def candidate_pals(n): # of length 2n + 1
if n == 0: yield from [2, 3, 5, 7]; return # one-digit primes
for rightbutend in product("0123456789", repeat=n-1):
rightbutend = "".join(rightbutend)
for end in "1379": # multi-digit primes must end in 1, 3, 7, or 9
left = end + rightbutend[::-1]
for mid in "0123456789": yield int(left + mid + rightbutend + end)
def a(n): return sum(isprime(p) for p in candidate_pals(n))
print([a(n) for n in range(6)]) # Michael S. Branicky, Apr 15 2021
CROSSREFS
Subsequence of A016115, which is the main entry.
Sequence in context: A322920 A332533 A013193 * A366697 A208991 A109365
KEYWORD
nonn,hard,base,more
AUTHOR
EXTENSIONS
a(9) from Shyam Sunder Gupta, Feb 12 2006
a(10) from Shyam Sunder Gupta, Mar 14 2009
a(11) from Shyam Sunder Gupta, Oct 05 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 09:48 EDT 2024. Contains 371905 sequences. (Running on oeis4.)