OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..1000
EXAMPLE
a(3) = 74759 is a term because it is prime, the next prime is 74761, and
74759*74761 + 74759 + 74761 = 5589207119
74759*74761 - 74759 - 74761 = 5588908079
74759*74761 + 2*(74759 + 74761) = 5589356639
74759*74761 - 2*(74759 + 74761) = 5588758559
are all prime.
MAPLE
q:= 2: R:= NULL: count:= 0:
while count < 40 do
p:= q; q:= nextprime(q); if isprime(p*q+p+q) and isprime(p*q-p-q) and isprime(p*q+2*p+2*q) and
isprime(p*q-2*p-2*q) then count:= count+1; R:= R, p; fi
od:
R;
MATHEMATICA
Select[Partition[Prime[Range[2*10^6]], 2, 1], AllTrue[{(p = #[[1]])*(q = #[[2]]) + p + q, p*q - p - q, p*q + 2*(p + q), p*q - 2*(p + q)}, PrimeQ] &][[;; , 1]] (* Amiram Eldar, Aug 26 2022 *)
PROG
(Python)
from sympy import isprime, nextprime
from itertools import count, islice
def agen(): # generator of terms
p, q = 2, 3
while True:
if all(isprime(t) for t in [p*q+p+q, p*q-p-q, p*q+2*(p+q), p*q-2*(p+q)]):
yield p
p, q = q, nextprime(q)
print(list(islice(agen(), 15))) # Michael S. Branicky, Aug 26 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Aug 26 2022
STATUS
approved