login
A346026
Primes that are the first in a run of exactly 6 emirps.
4
10039, 14891, 39791, 119773, 149561, 162293, 163781, 176903, 181751, 197383, 336689, 392911, 393361, 714361, 715361, 779003, 971141, 995443, 996539, 1165037, 1284487, 1307729, 1447151, 1611877, 1640539, 1789621, 1891147, 3136909, 3150557, 3284447, 3339943
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) = 10039 because of the eight consecutive primes 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093 all except 10037 and 10093 are emirps and this is the first such occurrence.
MATHEMATICA
EmQ[n_]:=(s=IntegerReverse@n; PrimeQ@s&&n!=s);
Select[Prime@Range[2, 50000], Boole[EmQ/@NextPrime[#, Range[-1, 6]]]=={0, 1, 1, 1, 1, 1, 1, 0}&] (* Giorgos Kalogeropoulos, Jul 27 2021 *)
PROG
(Python)
from sympy import isprime, nextprime, prime, primerange
def isemirp(p): s = str(p); return s != s[::-1] and isprime(int(s[::-1]))
def aupto(limit, runlength=6):
alst = []
pvec = list(primerange(1, prime(runlength+2)+1))
evec = [int(isemirp(p)) for p in pvec]
target = [0] + [1 for i in range(runlength)] + [0]
p = nextprime(pvec[-1])
while pvec[1] <= limit:
if evec == target: alst.append(pvec[1])
pvec = pvec[1:] + [p]; evec = evec[1:] + [isemirp(p)]; p = nextprime(p)
strp = str(p)
if strp[0] in "24568": # skip large gaps (p is a prime, not an emirp)
evec = [0 for i in range(runlength+2)]
pvec = [0 for i in range(runlength+2)]
p = nextprime(int(str(int(strp[0])+1)+'0'*(len(strp)-1)))
return alst
print(aupto(3339943)) # Michael S. Branicky, Jul 14 2021
CROSSREFS
Subsequence of A006567 (emirps).
Sequence in context: A205822 A251136 A213318 * A097648 A374372 A188663
KEYWORD
nonn,base
AUTHOR
Lars Blomberg, Jul 14 2021
STATUS
approved