%I #16 Sep 04 2022 12:51:22
%S 2,19,19,2,23,2,7,7,2,5,113,5,29,13,67,53,11,11,5,23,7,43,5,2,31,73,
%T 13,3,89,5,11,3,89,31,43,2,37,2,23,7,11,19,43,23,5,2,23,3,29,5,17,3,
%U 31,29,53,29,7,13,73,3,5,43,29,17,5,37,19,11,71,7,2,43,13,19,2,59,7,29,113,13,5,11
%N a(n) is the start of the first sequence of 2*n+1 consecutive primes p_1, p_2, ..., p_(2*n+1) such that p_1*p_2 + p_2*p_3 + ... + p_(2*n)*p_(2*n+1) + p_(2*n+1)*p_1 is prime.
%H Robert Israel, <a href="/A356477/b356477.txt">Table of n, a(n) for n = 1..10000</a>
%e 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.
%p f:= proc(m) local P,x,i,n;
%p n:= 2*m+1;
%p P:= Vector(n,ithprime);
%p do
%p x:= add(P[i]*P[i+1],i=1..n-1)+P[n]*P[1];
%p if isprime(x) then return P[1] fi;
%p P[1..n-1]:= P[2..n];
%p P[n]:= nextprime(P[n]);
%p od
%p end proc:
%p map(f, [$1..100]);
%o (Python)
%o from sympy import isprime, nextprime, prime, primerange
%o def a(n):
%o p = list(primerange(1, prime(2*n+1)+1))
%o while True:
%o if isprime(sum(p[i]*p[i+1] for i in range(len(p)-1))+p[-1]*p[0]):
%o return p[0]
%o p = p[1:] + [nextprime(p[-1])]
%o print([a(n) for n in range(1, 83)]) # _Michael S. Branicky_, Aug 08 2022
%Y Cf. A070934, A356471, A356475.
%K nonn
%O 1,1
%A _J. M. Bergot_ and _Robert Israel_, Aug 08 2022