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.
%I A040025 #34 Dec 19 2024 06:20:02 %S A040025 4,15,93,668,5172,42042,353701,3036643,27045226,239093865,2158090933, %T A040025 19742800564,180815391365 %N A040025 a(n) is the number of prime palindromes with 2n+1 digits. %H A040025 Shyam Sunder Gupta, <a href="https://listserv.nodak.edu/cgi-bin/wa.exe?A2=NMBRTHRY;d9a588c5.0602">Palindromic Primes up to 10^19</a>. %H A040025 Shyam Sunder Gupta, <a href="https://listserv.nodak.edu/cgi-bin/wa.exe?A2=NMBRTHRY;bdeb9ea2.0903">Palindromic Primes up to 10^21</a>. %H A040025 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 A040025 Shyam Sunder Gupta, <a href="https://listserv.nodak.edu/cgi-bin/wa.exe?A2=NMBRTHRY;a27957b6.2412&S=">Palindromic Primes up to 10^25</a>. %e A040025 a(1)=15 because Number of prime palindromes with 3 digits is 15. [_Shyam Sunder Gupta_, Mar 14 2009] %o A040025 (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 %o A040025 (Python) %o A040025 from sympy import isprime %o A040025 from itertools import product %o A040025 def candidate_pals(n): # of length 2n + 1 %o A040025 if n == 0: yield from [2, 3, 5, 7]; return # one-digit primes %o A040025 for rightbutend in product("0123456789", repeat=n-1): %o A040025 rightbutend = "".join(rightbutend) %o A040025 for end in "1379": # multi-digit primes must end in 1, 3, 7, or 9 %o A040025 left = end + rightbutend[::-1] %o A040025 for mid in "0123456789": yield int(left + mid + rightbutend + end) %o A040025 def a(n): return sum(isprime(p) for p in candidate_pals(n)) %o A040025 print([a(n) for n in range(6)]) # _Michael S. Branicky_, Apr 15 2021 %Y A040025 Subsequence of A016115, which is the main entry. %K A040025 nonn,hard,base,more %O A040025 0,1 %A A040025 _Patrick De Geest_ %E A040025 a(9) from _Shyam Sunder Gupta_, Feb 12 2006 %E A040025 a(10) from _Shyam Sunder Gupta_, Mar 14 2009 %E A040025 a(11) from _Shyam Sunder Gupta_, Oct 05 2013 %E A040025 a(12) from _Shyam Sunder Gupta_, Dec 19 2024