The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A050251 Number of palindromic primes less than 10^n. 4
0, 4, 5, 20, 20, 113, 113, 781, 781, 5953, 5953, 47995, 47995, 401696, 401696, 3438339, 3438339, 30483565, 30483565, 269577430, 269577430, 2427668363, 2427668363, 22170468927, 22170468927 (list; graph; refs; listen; history; text; internal format)
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
Shyam Sunder Gupta, Palindromic Primes up to 10^19.
Shyam Sunder Gupta, Palindromic Primes up to 10^23.
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
Partial sums of A016115.
Cf. A002113 (palindromes), A002385 (palindromic primes).
Sequence in context: A193964 A337443 A099897 * A125995 A080610 A047175
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
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 May 14 17:00 EDT 2024. Contains 372533 sequences. (Running on oeis4.)