OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(2) = 19 because 19 is the start of the 2*2+1 = 5 consecutive primes 19, 23, 29, 31, 37 with 19*23 + 23*29 + 29*31 + 31*37 + 37*19 = 3853 prime, and no earlier 5-tuple of consecutive primes works.
MAPLE
f:= proc(m) local P, x, i, n;
n:= 2*m+1;
P:= Vector(n, ithprime);
do
x:= add(P[i]*P[i+1], i=1..n-1)+P[n]*P[1];
if isprime(x) then return P[1] fi;
P[1..n-1]:= P[2..n];
P[n]:= nextprime(P[n]);
od
end proc:
map(f, [$1..100]);
PROG
(Python)
from sympy import isprime, nextprime, prime, primerange
def a(n):
p = list(primerange(1, prime(2*n+1)+1))
while True:
if isprime(sum(p[i]*p[i+1] for i in range(len(p)-1))+p[-1]*p[0]):
return p[0]
p = p[1:] + [nextprime(p[-1])]
print([a(n) for n in range(1, 83)]) # Michael S. Branicky, Aug 08 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Aug 08 2022
STATUS
approved