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.

A346026 Primes that are the first in a run of exactly 6 emirps.

This page as a plain text file.
%I A346026 #9 Aug 08 2021 11:33:57
%S A346026 10039,14891,39791,119773,149561,162293,163781,176903,181751,197383,
%T A346026 336689,392911,393361,714361,715361,779003,971141,995443,996539,
%U A346026 1165037,1284487,1307729,1447151,1611877,1640539,1789621,1891147,3136909,3150557,3284447,3339943
%N A346026 Primes that are the first in a run of exactly 6 emirps.
%C A346026 There are large gaps in this sequence because all terms need to begin with 1, 3, 7, or 9 otherwise the reversal is composite.
%e A346026 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.
%t A346026 EmQ[n_]:=(s=IntegerReverse@n;PrimeQ@s&&n!=s);
%t A346026 Select[Prime@Range[2,50000],Boole[EmQ/@NextPrime[#,Range[-1,6]]]=={0,1,1,1,1,1,1,0}&] (* _Giorgos Kalogeropoulos_, Jul 27 2021 *)
%o A346026 (Python)
%o A346026 from sympy import isprime, nextprime, prime, primerange
%o A346026 def isemirp(p): s = str(p); return s != s[::-1] and isprime(int(s[::-1]))
%o A346026 def aupto(limit, runlength=6):
%o A346026   alst = []
%o A346026   pvec = list(primerange(1, prime(runlength+2)+1))
%o A346026   evec = [int(isemirp(p)) for p in pvec]
%o A346026   target = [0] + [1 for i in range(runlength)] + [0]
%o A346026   p = nextprime(pvec[-1])
%o A346026   while pvec[1] <= limit:
%o A346026     if evec == target: alst.append(pvec[1])
%o A346026     pvec = pvec[1:] + [p]; evec = evec[1:] + [isemirp(p)]; p = nextprime(p)
%o A346026     strp = str(p)
%o A346026     if strp[0] in "24568": # skip large gaps (p is a prime, not an emirp)
%o A346026       evec = [0 for i in range(runlength+2)]
%o A346026       pvec = [0 for i in range(runlength+2)]
%o A346026       p = nextprime(int(str(int(strp[0])+1)+'0'*(len(strp)-1)))
%o A346026   return alst
%o A346026 print(aupto(3339943)) # _Michael S. Branicky_, Jul 14 2021
%Y A346026 Subsequence of A006567 (emirps).
%Y A346026 Cf. A003684, A048052, A048054, A071612, A346022, A346023, A346024, A346025.
%K A346026 nonn,base
%O A346026 1,1
%A A346026 _Lars Blomberg_, Jul 14 2021