%I #13 Feb 02 2022 07:19:25
%S 228647,642457,3678317,4424699,5507669,8439073,8527301,8545387,
%T 9207197,9490571,9843049,10023817,10148123,10670909,11621243,11697979,
%U 12208459,12409849,12687119,12845879,12947071,13590457,13940057,14377747,14511053,15309937,16628009,16713731,16982153,17073041,17302639
%N First of three consecutive primes p,q,r such that p+q-r, p-q+r, -p+q+r are all prime.
%C Each term is the second in an arithmetic progression of five primes, of which at least the second, third and fourth are consecutive primes.
%H Robert Israel, <a href="/A351054/b351054.txt">Table of n, a(n) for n = 1..1000</a>
%e a(3) = 3678317 is a term because it is prime, the next two primes are 3678347 and 3678377, and 3678317+3678347-3678377 = 3678287, 3678317-3678347+3678377 = 3678347, and -3678317+3678347+3678377 = 3678407 are all primes.
%p f:= proc(p,q,r)
%p isprime(p+q-r) and isprime(p-q+r) and isprime(-p+q+r)
%p end proc:
%p p:= 2: q:= 3: r:= 5: R:= NULL: count:= 0:
%p while r < 10^8 do
%p p:= q; q:= r; r:= nextprime(r);
%p if f(p,q,r) then count:= count+1; R:= R,p fi
%p od:
%p R;
%o (Python)
%o from sympy import isprime, nextprime
%o def c(p, q, r): return isprime(p+q-r) and isprime(p-q+r) and isprime(-p+q+r)
%o def afind():
%o p, q, r = 2, 3, 5
%o while True:
%o if c(p, q, r): print(p, end=", ")
%o p, q, r = q, r, nextprime(r)
%o afind() # _Michael S. Branicky_, Jan 30 2022
%K nonn
%O 1,1
%A _J. M. Bergot_ and _Robert Israel_, Jan 30 2022