login
Primes p such that (p^2+q^2)/2 and (q^2 + 2*p*q - p^2)/2 are prime, where q is the next prime after p.
1

%I #14 Dec 27 2020 15:28:28

%S 3,5,13,199,419,421,1187,1319,1693,1783,2029,2069,2861,3041,3559,3881,

%T 4493,4523,4957,5153,6359,7187,7193,8171,8293,8623,8719,8783,9629,

%U 10631,12601,13829,13831,15013,15817,16183,16339,17519,18169,18593,18773,18913,19219,19301,19379,19597,20201,20533

%N Primes p such that (p^2+q^2)/2 and (q^2 + 2*p*q - p^2)/2 are prime, where q is the next prime after p.

%C p*q, (q^2-p^2)/2 and (p^2+q^2)/2 are the sides of a right triangle whose hypotenuse and sum of the other two sides are prime.

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

%e a(3) = 13 is a term because it is prime, the next prime is 17, and (13^2+17^2)/2 = 229 and (17^2+2*13*17-13^2)/2 = 281 are prime.

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

%p while count < 100 do

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

%p if isprime((p^2+q^2)/2) and isprime((q^2+2*p*q-p^2)/2) then

%p count:= count+1; R:= R, p;

%p fi

%p od:

%p R;

%o (PARI) isok(p) = if ((p>2) && isprime(p), my(q=nextprime(p+1)); isprime((p^2+q^2)/2) && isprime((q^2 + 2*p*q - p^2)/2)) \\ _Michel Marcus_, Dec 27 2020

%K nonn

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Dec 26 2020