A346026 Primes that are the first in a run of exactly 6 emirps.
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
Examples
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.
Crossrefs
Programs
-
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 *)
-
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
Comments