login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A346021
Primes that are the first in a run of exactly 1 emirp.
0
97, 107, 113, 149, 157, 167, 179, 199, 311, 359, 389, 907, 1009, 1061, 1069, 1091, 1181, 1301, 1321, 1429, 1439, 1453, 1471, 1487, 1559, 1619, 1657, 1669, 1753, 1789, 1811, 1867, 1879, 1901, 1913, 1979, 3049, 3067, 3121, 3163, 3169, 3221, 3251, 3257, 3319
OFFSET
1,1
COMMENTS
There are large gaps in this sequence because all terms need to begin with 1, 3, 7, or 9 otherwise the reversal is composite.
EXAMPLE
a(1) = 97 because of the three consecutive primes 89, 97, 101 only 97 is an emirp and this is the first such occurrence.
MATHEMATICA
emirpQ[p_] := (r = IntegerReverse[p]) != p && PrimeQ[r]; p = Select[Range[3400], PrimeQ]; p[[1 + Position[Partition[emirpQ /@ p, 3, 1], {False, True, False}] // Flatten]] (* Amiram Eldar, Jul 14 2021 *)
PROG
(Python)
from sympy import isprime, nextprime
def isemirp(p): s = str(p); return s != s[::-1] and isprime(int(s[::-1]))
def aupto(limit):
alst, pvec, evec, p = [], [2, 3, 5], [0, 0, 0], 7
while pvec[1] <= limit:
if evec == [0, 1, 0]: alst.append(pvec[1])
pvec = pvec[1:] + [p]; evec = evec[1:] + [isemirp(p)]; p = nextprime(p)
return alst
print(aupto(3319)) # Michael S. Branicky, Jul 14 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Lars Blomberg, Jul 14 2021
STATUS
approved