login
A356745
a(n) is the first prime that starts a string of exactly n consecutive primes where the prime + the next prime + 1 is prime.
0
37, 5, 283, 929, 13, 696607, 531901, 408079937, 17028422981
OFFSET
1,1
COMMENTS
a(n) is the first prime p(k) such that p(k+i)+p(k+i+1)+1 is prime for i from 0 to n-1, but not for i=-1 or n.
EXAMPLE
a(5) = 13 because 13+17+1 = 31, 17+19+1 = 37, 19+23+1 = 43, 23+29+1 = 53, and 29+31+1 = 61 are prime, but 11+13+1 = 25 and 31+37+1 = 69 are not, and 13 is the first prime that works.
MAPLE
P:= select(isprime, [seq(i, i=3..10^6, 2)]):
V:= Vector(7):
state:= 0:
for i from 1 to nops(P)-1 do
if isprime(P[i]+P[i+1]+1) then
state:= state+1
else
if state > 0 and V[state] = 0 then V[state]:= P[i-state] fi;
state:= 0
fi
od:
convert(V, list);
PROG
(Python)
from itertools import count, islice
from sympy import isprime, nextprime
def f(p):
c, p0, p1 = 0, p, nextprime(p)
while isprime(p0+p1+1):
c, p0, p1 = c+1, p1, nextprime(p1)
return c, p1
def agen():
n, adict, pk = 1, dict(), 2
for k in count(1):
fk, pk2 = f(pk)
if fk not in adict: adict[fk] = pk
while n in adict: yield adict[n]; n += 1
pk = pk2
print(list(islice(agen(), 7))) # Michael S. Branicky, Sep 18 2022
CROSSREFS
Cf. A177017.
Sequence in context: A178199 A107812 A254324 * A068843 A284497 A033357
KEYWORD
nonn,more
AUTHOR
J. M. Bergot and Robert Israel, Sep 17 2022
EXTENSIONS
a(8)-a(9) from Michael S. Branicky, Sep 18 2022
STATUS
approved