login
Primes p such that (p*q+r*s)/2 is prime, where q,r,s are the next 3 primes after p.
2

%I #13 Feb 06 2023 12:03:38

%S 5,7,11,23,53,73,107,137,157,179,263,281,317,373,457,593,673,821,857,

%T 1087,1297,1481,1619,1753,1789,2203,2221,2383,2459,2557,2683,2767,

%U 2797,2803,2833,3331,3359,3371,3733,3967,4051,4217,4783,4967,5023,5113,5171,5309,5351,5443,5449,5573,6079,6163

%N Primes p such that (p*q+r*s)/2 is prime, where q,r,s are the next 3 primes after p.

%H Robert Israel, <a href="/A340308/b340308.txt">Table of n, a(n) for n = 1..10000</a>

%e a(3) = 11 is a term because (11*13+17*19)/2 = 233 is prime.

%p q:= 3: r:= 5: s:= 7:

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

%p while count < 100 do

%p p:= q; q:= r; r:= s; s:= nextprime(s);

%p v:= (p*q + r*s)/2;

%p if isprime(v) then count:= count+1; R:= R, p fi

%p od:

%p R;

%t Select[Partition[Prime[Range[1000]],4,1],PrimeQ[(#[[1]]#[[2]]+#[[3]]#[[4]])/2]&][[All,1]] (* _Harvey P. Dale_, Feb 06 2023 *)

%o (PARI) isok(p) = if (isprime(p) && (p>2), my(q=nextprime(p+1), r=nextprime(q+1), s=nextprime(r+1)); isprime((p*q+r*s)/2)); \\ _Michel Marcus_, Jan 04 2021

%Y Cf. A340307.

%K nonn

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Jan 03 2021