login
a(n) = smallest prime q > a(n-1) such that 2*prime(n)*q^prime(n)+1 is also prime.
1

%I #12 Jul 03 2021 13:27:02

%S 2,3,7,17,1579,1997,2347,3323,6637,11161,13829,18287,40759,42197,

%T 42337,45757,46141,48383,49253,51631,52541,53549,73477,78079,81677,

%U 111439,164363,166567,170441,180667,191507,202729,209029,257351,292471,294809,300569,328787

%N a(n) = smallest prime q > a(n-1) such that 2*prime(n)*q^prime(n)+1 is also prime.

%H Pierre CAMI, <a href="/A225747/b225747.txt">Table of n, a(n) for n = 1..177</a>

%e 2*2*2^2+1=17 prime so a(1)=2,

%e 2*3*2^3+1=49 composite,

%e 2*3*3^3+1=163 prime so a(2)=3 as 3>2.

%t nxt[{n_,a_}]:=Module[{p=NextPrime[a],c=Prime[n+1]},While[!PrimeQ[ 2*c*p^c+1],p = NextPrime[ p]];{n+1,p}]; NestList[nxt,{1,2},40][[All,2]] (* _Harvey P. Dale_, Jul 03 2021 *)

%o (PFGW & SCRIPTIFY)

%o SCRIPT

%o DIM n,0

%o DIM k,0

%o DIM q

%o DIMS t

%o OPENFILEOUT myfile,a(n).txt

%o LABEL a

%o SET n,n+1

%o IF n>177 THEN END

%o LABEL b

%o SET k,k+1

%o SET q,p(k)

%o SETS t,%d\,;q

%o PRP 2*p(n)*q^p(n)+1,t

%o IF ISPRP THEN GOTO c

%o GOTO b

%o LABEL c

%o WRITE myfile,q

%o GOTO a

%Y Cf. A225403.

%K nonn

%O 1,1

%A _Pierre CAMI_, May 14 2013