login
Primes p such that the sum of both three and five consecutive primes starting with p is prime.
3

%I #22 Feb 11 2024 11:43:21

%S 5,7,11,19,29,31,53,67,79,109,149,157,163,211,229,311,349,379,401,409,

%T 449,467,653,757,809,839,857,863,883,983,997,1033,1087,1103,1187,1193,

%U 1289,1301,1303,1409,1481,1523,1553,1637,1663,1669,1709,1951,1973

%N Primes p such that the sum of both three and five consecutive primes starting with p is prime.

%H Harvey P. Dale, <a href="/A182121/b182121.txt">Table of n, a(n) for n = 1..1000</a>

%e 5 is in the sequence because 5 + 7 + 11 = 23 is prime and 5 + 7 + 11 + 13 + 17 = 53 is also prime.

%t cpQ[n_]:=Module[{ppi=PrimePi[n],cnsc},cnsc=Prime[Range[ppi,ppi+4]];And@@ PrimeQ[ {Total[cnsc],Total[Take[cnsc,3]]}]]; Select[Prime[Range[300]],cpQ] (* _Harvey P. Dale_, Mar 28 2013 *)

%t Select[Partition[Prime[Range[500]],5,1],AllTrue[{Total[Take[#,3]],Total[#]},PrimeQ]&][[;;,1]] (* _Harvey P. Dale_, Feb 11 2024 *)

%o (PARI) {a=2;b=3;c=5;d=7;e=11;for(n=1,300,s=a+b+c+d+e;

%o if(isprime(s)&&isprime(a+b+c),print1(a","));a=b;b=c;c=d;d=e;e=nextprime(e+2))}

%Y Intersection of A073681 and A152468.

%K nonn

%O 1,1

%A _Zak Seidov_, Dec 17 2012