login
Smallest prime Q greater than prime(n+1) such that the sum prime(n)+prime(n+1)+Q is also prime, starting with n=2.
2

%I #20 Apr 08 2018 13:18:32

%S 11,11,13,17,23,23,29,31,37,41,53,47,59,67,61,71,71,73,79,89,89,97,

%T 107,109,107,127,131,127,139,139,151,157,151,157,179,167,173,181,211,

%U 197,197,223,211,211,233,227,233,263,239,271,263,269,313,277,277,281,281

%N Smallest prime Q greater than prime(n+1) such that the sum prime(n)+prime(n+1)+Q is also prime, starting with n=2.

%C The sequence A152470 is a subsequence.

%H Pierre CAMI, <a href="/A246400/b246400.txt">Table of n, a(n) for n = 2..10001</a>

%e 3+5+7=15 is composite and 3+5+11=19 is prime so a(2)=11.

%e 5+7+11=23 is prime so a(3)=11.

%t spq[n_]:=Module[{m=NextPrime[n],q},q=NextPrime[m];While[!PrimeQ[ m+n+q], q=NextPrime[q]];q]; Table[spq[n],{n,Prime[Range[2,60]]}] (* _Harvey P. Dale_, Apr 08 2018 *)

%o (PFGW & SCRIPT)

%o SCRIPT

%o DIM k

%o DIM n,1

%o OPENFILEOUT myf,a(n).txt

%o LABEL loop1

%o SET n,n+1

%o IF n>10001 THEN END

%o SET k,n+1

%o LABEL loop2

%o SET k,k+1

%o PRP p(n)+p(n+1)+p(k)

%o IF ISPRP then GOTO a

%o GOTO loop2

%o LABEL a

%o WRITE myf,p(k)

%o GOTO loop1

%o (PARI) a(n) = t=prime(n)+prime(n+1); k=n+2; while(!isprime(t+q=prime(k)), k++); q \\ _Colin Barker_, Aug 25 2014

%Y Cf. A152470.

%K nonn

%O 2,1

%A _Pierre CAMI_, Aug 25 2014