OFFSET
1,1
MAPLE
g:= proc(p) local q;
q:= 3:
do
q:= nextprime(q);
if isprime(p+q^2-1) and isprime(p+q^2+1) then return q fi;
od
end proc:
R:= NULL: count:= 0: w:= 0:
for nn from 5 by 6 while count < 15 do
if isprime(nn) then
v:= g(nn);
if v > w then count:= count+1; R:= R, v; w:= v; fi
fi
od:
R;
MATHEMATICA
g[p_] := Module[{q}, q = 3; While[True, q = NextPrime[q]; If [PrimeQ[p + q^2 - 1] && PrimeQ[p + q^2 + 1], Return@q]]];
R = {}; count = 0; w = 0;
For[nn = 5, count < 15, nn = nn + 6, If[PrimeQ[nn], v = g[nn]; If[v > w, count++; Print[count, " ", v]; R = Append[R, v]; w = v]]];
R (* Jean-François Alcover, Mar 07 2024, after Robert Israel *)
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Robert Israel, Nov 23 2020
EXTENSIONS
a(16)-a(17) from Jinyuan Wang, Dec 04 2020
a(18)-a(21) from Chai Wah Wu, Jan 15 2021
STATUS
approved