login
A339096
Record values in A306400.
0
5, 7, 11, 23, 701, 3989, 4397, 5501, 7309, 9281, 10331, 11243, 12907, 16127, 27917, 39901, 43051, 44843, 48397, 66569, 70657
OFFSET
1,1
EXAMPLE
a(3) = 11 is in the sequence because A306400(5) = 11 and A306400(k)<11 for k < 5.
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
Cf. A306400.
Sequence in context: A181602 A075705 A340308 * A249735 A218394 A067289
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