login
Record values in A306400.
0

%I #17 Mar 07 2024 08:52:21

%S 5,7,11,23,701,3989,4397,5501,7309,9281,10331,11243,12907,16127,27917,

%T 39901,43051,44843,48397,66569,70657

%N Record values in A306400.

%e a(3) = 11 is in the sequence because A306400(5) = 11 and A306400(k)<11 for k < 5.

%p g:= proc(p) local q;

%p q:= 3:

%p do

%p q:= nextprime(q);

%p if isprime(p+q^2-1) and isprime(p+q^2+1) then return q fi;

%p od

%p end proc:

%p R:= NULL: count:= 0: w:= 0:

%p for nn from 5 by 6 while count < 15 do

%p if isprime(nn) then

%p v:= g(nn);

%p if v > w then count:= count+1; R:= R, v; w:= v; fi

%p fi

%p od:

%p R;

%t g[p_] := Module[{q}, q = 3; While[True, q = NextPrime[q]; If [PrimeQ[p + q^2 - 1] && PrimeQ[p + q^2 + 1], Return@q]]];

%t R = {}; count = 0; w = 0;

%t 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]]];

%t R (* _Jean-François Alcover_, Mar 07 2024, after _Robert Israel_ *)

%Y Cf. A306400.

%K nonn,more

%O 1,1

%A _Robert Israel_, Nov 23 2020

%E a(16)-a(17) from _Jinyuan Wang_, Dec 04 2020

%E a(18)-a(21) from _Chai Wah Wu_, Jan 15 2021