login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A346021 Primes that are the first in a run of exactly 1 emirp. 0

%I #9 Aug 08 2021 11:33:43

%S 97,107,113,149,157,167,179,199,311,359,389,907,1009,1061,1069,1091,

%T 1181,1301,1321,1429,1439,1453,1471,1487,1559,1619,1657,1669,1753,

%U 1789,1811,1867,1879,1901,1913,1979,3049,3067,3121,3163,3169,3221,3251,3257,3319

%N Primes that are the first in a run of exactly 1 emirp.

%C 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 a(1) = 97 because of the three consecutive primes 89, 97, 101 only 97 is an emirp and this is the first such occurrence.

%t 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 *)

%o (Python)

%o from sympy import isprime, nextprime

%o def isemirp(p): s = str(p); return s != s[::-1] and isprime(int(s[::-1]))

%o def aupto(limit):

%o alst, pvec, evec, p = [], [2, 3, 5], [0, 0, 0], 7

%o while pvec[1] <= limit:

%o if evec == [0, 1, 0]: alst.append(pvec[1])

%o pvec = pvec[1:] + [p]; evec = evec[1:] + [isemirp(p)]; p = nextprime(p)

%o return alst

%o print(aupto(3319)) # _Michael S. Branicky_, Jul 14 2021

%Y Subsequence of A006567 (emirps).

%Y Cf. A003684, A048052, A048054, A071612, A346022, A346023, A346024, A346025, A346026, A346027, A346028, A346029.

%K nonn,base

%O 1,1

%A _Lars Blomberg_, Jul 14 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 1 14:26 EDT 2024. Contains 374818 sequences. (Running on oeis4.)