OFFSET
0,2
COMMENTS
Every palindrome with an even number of digits is divisible by 11 and therefore is composite (not prime). Hence there is only one palindromic prime with an even number of digits, 11. - Martin Renner, Apr 15 2006
LINKS
Patrick De Geest, World!Of Palindromic Primes, Page 1
Shyam Sunder Gupta, Palindromic Primes up to 10^19.
Shyam Sunder Gupta, Palindromic Primes up to 10^23.
Shyam Sunder Gupta, Palindromic Primes up to 10^25.
Eric Weisstein's World of Mathematics, Palindromic Prime.
FORMULA
a(n) ~ A070199(n)/log(10^n) = 1/log(10^n)*Sum {k=1..n} 9*10^floor[(k-1)/2]. - Robert G. Wilson v, May 31 2009
a(2n) = a(2n-1) for n > 1. - Chai Wah Wu, Nov 21 2021
PROG
(Python)
from __future__ import division
from sympy import isprime
def paloddgen(l, b=10): # generator of odd-length palindromes in base b of length <= 2*l
if l > 0:
yield 0
for x in range(1, l+1):
n = b**(x-1)
n2 = n*b
for y in range(n, n2):
k, m = y//b, 0
while k >= b:
k, r = divmod(k, b)
m = b*m + r
yield y*n + b*m + k
def A050251(n):
if n <= 1:
return 4*n
else:
c = 1
for i in paloddgen((n+1)//2):
if isprime(i):
c += 1
return c # Chai Wah Wu, Jan 05 2015
CROSSREFS
KEYWORD
nonn,hard,nice,base,more
AUTHOR
EXTENSIONS
More terms from Patrick De Geest, Aug 01 1999
2 more terms from Shyam Sunder Gupta, Feb 12 2006
2 more terms from Shyam Sunder Gupta, Mar 13 2009
a(23)-a(24) from Shyam Sunder Gupta, Oct 05 2013
Missing a(0) inserted by Chai Wah Wu, Nov 21 2021
a(25)-a(26) from Shyam Sunder Gupta, Dec 19 2024
STATUS
approved