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.

A007500 Primes whose reversal in base 10 is also prime (called "palindromic primes" by David Wells, although that name usually refers to A002385). Also called reversible primes.

This page as a plain text file.
%I A007500 M0657 #63 Jul 15 2025 11:35:54
%S A007500 2,3,5,7,11,13,17,31,37,71,73,79,97,101,107,113,131,149,151,157,167,
%T A007500 179,181,191,199,311,313,337,347,353,359,373,383,389,701,709,727,733,
%U A007500 739,743,751,757,761,769,787,797,907,919,929,937,941,953,967,971,983,991,1009,1021
%N A007500 Primes whose reversal in base 10 is also prime (called "palindromic primes" by David Wells, although that name usually refers to A002385). Also called reversible primes.
%C A007500 The numbers themselves need not be palindromes.
%C A007500 The range is a subset of the range of A071786. - _Reinhard Zumkeller_, Jul 06 2009
%C A007500 Number of terms less than 10^n: 4, 13, 56, 260, 1759, 11297, 82439, 618017, 4815213, 38434593, ..., . - _Robert G. Wilson v_, Jan 08 2015
%D A007500 Roozbeh Hazrat, Mathematica: A Problem-Centered Approach, Springer 2010, pp. 39, 131-132
%D A007500 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%D A007500 James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 113.
%D A007500 David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, 134.
%H A007500 T. D. Noe, <a href="/A007500/b007500.txt">Table of n, a(n) for n = 1..10000</a>
%H A007500 Cécile Dartyge, Bruno Martin, Joël Rivat, Igor E. Shparlinski, and Cathy Swaenepoel, <a href="https://arxiv.org/abs/2309.11380">Reversible primes</a>, arXiv:2309.11380 [math.NT], 2023. See p. 3.
%p A007500 revdigs:= proc(n)
%p A007500 local L,nL,i;
%p A007500 L:= convert(n,base,10);
%p A007500 nL:= nops(L);
%p A007500 add(L[i]*10^(nL-i),i=1..nL);
%p A007500 end:
%p A007500 Primes:= select(isprime,{2,seq(2*i+1,i=1..5*10^5)}):
%p A007500 Primes intersect map(revdigs,Primes); # _Robert Israel_, Aug 14 2014
%t A007500 Select[ Prime[ Range[ 168 ] ], PrimeQ[ FromDigits[ Reverse[ IntegerDigits[ # ] ] ] ]& ] (* _Zak Seidov_, corrected by _T. D. Noe_ *)
%t A007500 Select[Prime[Range[1000]],PrimeQ[IntegerReverse[#]]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Aug 15 2016 *)
%o A007500 (Magma) [ p: p in PrimesUpTo(1030) | IsPrime(Seqint(Reverse(Intseq(p)))) ];  // _Bruno Berselli_, Jul 08 2011
%o A007500 (Haskell)
%o A007500 a007500 n = a007500_list !! (n-1)
%o A007500 a007500_list = filter ((== 1) . a010051 . a004086) a000040_list
%o A007500 -- _Reinhard Zumkeller_, Oct 14 2011
%o A007500 (PARI) is_A007500(n)={ isprime(n) & is_A095179(n)} \\ _M. F. Hasler_, Jan 13 2012
%o A007500 (Python)
%o A007500 from sympy import prime, isprime
%o A007500 A007500 = [prime(n) for n in range(1,10**6) if isprime(int(str(prime(n))[::-1]))] # _Chai Wah Wu_, Aug 14 2014
%o A007500 (Python)
%o A007500 from gmpy2 import is_prime, mpz
%o A007500 from itertools import count, islice, product
%o A007500 def agen(): # generator of terms
%o A007500     yield from [2, 3, 5, 7]
%o A007500     p = 11
%o A007500     for digits in count(2):
%o A007500         for first in "1379":
%o A007500             for mid in product("0123456789", repeat=digits-2):
%o A007500                 for last in "1379":
%o A007500                     s = first + "".join(mid) + last
%o A007500                     if is_prime(t:=mpz(s)) and is_prime(mpz(s[::-1])):
%o A007500                         yield int(t)
%o A007500 print(list(islice(agen(), 60))) # _Michael S. Branicky_, Jan 02 2025
%Y A007500 Cf. A006567, A007628.
%Y A007500 Cf. A002385 (primes that are palindromes in base 10).
%Y A007500 Equals A002385 union A006567.
%Y A007500 Complement of A076056 with respect to A000040. [From _Reinhard Zumkeller_, Jul 06 2009]
%Y A007500 Cf. A004086, A010051, A000040.
%K A007500 base,nonn,nice
%O A007500 1,1
%A A007500 _N. J. A. Sloane_, _Robert G. Wilson v_
%E A007500 More terms from Larry Reeves (larryr(AT)acm.org), Oct 31 2000
%E A007500 Added further terms to the sequence Avik Roy (avik_3.1416(AT)yahoo.co.in), Jan 16 2009. Checked by _N. J. A. Sloane_, Jan 20 2009.
%E A007500 Third reference added by _Harvey P. Dale_, Oct 17 2011