cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A050251 Number of palindromic primes less than 10^n.

This page as a plain text file.
%I A050251 #61 Feb 16 2025 08:32:40
%S A050251 0,4,5,20,20,113,113,781,781,5953,5953,47995,47995,401696,401696,
%T A050251 3438339,3438339,30483565,30483565,269577430,269577430,2427668363,
%U A050251 2427668363,22170468927,22170468927,202985860292,202985860292
%N A050251 Number of palindromic primes less than 10^n.
%C A050251 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
%H A050251 Patrick De Geest, <a href="https://www.worldofnumbers.com/palprim1.htm">World!Of Palindromic Primes, Page 1</a>
%H A050251 Shyam Sunder Gupta, <a href="http://listserv.nodak.edu/cgi-bin/wa.exe?A1=ind0602&amp;L=nmbrthry">Palindromic Primes up to 10^19</a>.
%H A050251 Shyam Sunder Gupta, <a href="https://listserv.nodak.edu/cgi-bin/wa.exe?A2=NMBRTHRY;b79493a6.1310">Palindromic Primes up to 10^23</a>.
%H A050251 Shyam Sunder Gupta, <a href="https://listserv.nodak.edu/cgi-bin/wa.exe?A2=NMBRTHRY;a27957b6.2412&amp;S=">Palindromic Primes up to 10^25</a>.
%H A050251 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PalindromicPrime.html">Palindromic Prime.</a>
%H A050251 <a href="/index/Pri#primepop">Index entries for sequences related to numbers of primes in various ranges</a>
%F A050251 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
%F A050251 a(2n) = a(2n-1) for n > 1. - _Chai Wah Wu_, Nov 21 2021
%o A050251 (Python)
%o A050251 from __future__ import division
%o A050251 from sympy import isprime
%o A050251 def paloddgen(l,b=10): # generator of odd-length palindromes in base b of length <= 2*l
%o A050251     if l > 0:
%o A050251         yield 0
%o A050251         for x in range(1,l+1):
%o A050251             n = b**(x-1)
%o A050251             n2 = n*b
%o A050251             for y in range(n,n2):
%o A050251                 k, m = y//b, 0
%o A050251                 while k >= b:
%o A050251                     k, r = divmod(k,b)
%o A050251                     m = b*m + r
%o A050251                 yield y*n + b*m + k
%o A050251 def A050251(n):
%o A050251     if n <= 1:
%o A050251         return 4*n
%o A050251     else:
%o A050251         c = 1
%o A050251         for i in paloddgen((n+1)//2):
%o A050251             if isprime(i):
%o A050251                 c += 1
%o A050251         return c # _Chai Wah Wu_, Jan 05 2015
%Y A050251 Partial sums of A016115.
%Y A050251 Cf. A002113 (palindromes), A002385 (palindromic primes).
%K A050251 nonn,hard,nice,base,more
%O A050251 0,2
%A A050251 _Eric W. Weisstein_
%E A050251 More terms from _Patrick De Geest_, Aug 01 1999
%E A050251 2 more terms from _Shyam Sunder Gupta_, Feb 12 2006
%E A050251 2 more terms from _Shyam Sunder Gupta_, Mar 13 2009
%E A050251 a(23)-a(24) from _Shyam Sunder Gupta_, Oct 05 2013
%E A050251 Missing a(0) inserted by _Chai Wah Wu_, Nov 21 2021
%E A050251 a(25)-a(26) from _Shyam Sunder Gupta_, Dec 19 2024