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.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 101, 107, 113, 131, 149, 151, 157, 167, 179, 181, 191, 199, 311, 313, 337, 347, 353, 359, 373, 383, 389, 701, 709, 727, 733, 739, 743, 751, 757, 761, 769, 787, 797, 907, 919, 929, 937, 941, 953, 967, 971, 983, 991, 1009, 1021
Offset: 1

Views

Author

Keywords

Comments

The numbers themselves need not be palindromes.
The range is a subset of the range of A071786. - Reinhard Zumkeller, Jul 06 2009
Number of terms less than 10^n: 4, 13, 56, 260, 1759, 11297, 82439, 618017, 4815213, 38434593, ..., . - Robert G. Wilson v, Jan 08 2015

References

  • Roozbeh Hazrat, Mathematica: A Problem-Centered Approach, Springer 2010, pp. 39, 131-132
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 113.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, 134.

Crossrefs

Cf. A002385 (primes that are palindromes in base 10).
Equals A002385 union A006567.
Complement of A076056 with respect to A000040. [From Reinhard Zumkeller, Jul 06 2009]

Programs

  • Haskell
    a007500 n = a007500_list !! (n-1)
    a007500_list = filter ((== 1) . a010051 . a004086) a000040_list
    -- Reinhard Zumkeller, Oct 14 2011
    
  • Magma
    [ p: p in PrimesUpTo(1030) | IsPrime(Seqint(Reverse(Intseq(p)))) ];  // Bruno Berselli, Jul 08 2011
    
  • Maple
    revdigs:= proc(n)
    local L,nL,i;
    L:= convert(n,base,10);
    nL:= nops(L);
    add(L[i]*10^(nL-i),i=1..nL);
    end:
    Primes:= select(isprime,{2,seq(2*i+1,i=1..5*10^5)}):
    Primes intersect map(revdigs,Primes); # Robert Israel, Aug 14 2014
  • Mathematica
    Select[ Prime[ Range[ 168 ] ], PrimeQ[ FromDigits[ Reverse[ IntegerDigits[ # ] ] ] ]& ] (* Zak Seidov, corrected by T. D. Noe *)
    Select[Prime[Range[1000]],PrimeQ[IntegerReverse[#]]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 15 2016 *)
  • PARI
    is_A007500(n)={ isprime(n) & is_A095179(n)} \\ M. F. Hasler, Jan 13 2012
    
  • Python
    from sympy import prime, isprime
    A007500 = [prime(n) for n in range(1,10**6) if isprime(int(str(prime(n))[::-1]))] # Chai Wah Wu, Aug 14 2014
    
  • Python
    from gmpy2 import is_prime, mpz
    from itertools import count, islice, product
    def agen(): # generator of terms
        yield from [2, 3, 5, 7]
        p = 11
        for digits in count(2):
            for first in "1379":
                for mid in product("0123456789", repeat=digits-2):
                    for last in "1379":
                        s = first + "".join(mid) + last
                        if is_prime(t:=mpz(s)) and is_prime(mpz(s[::-1])):
                            yield int(t)
    print(list(islice(agen(), 60))) # Michael S. Branicky, Jan 02 2025

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Oct 31 2000
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.
Third reference added by Harvey P. Dale, Oct 17 2011