login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A356762
Primes p such that, if q is the next prime, p*q+p+q, p*q-p-q, p*q+2*(p+q) and p*q-2*(p+q) are all prime.
2
5, 50929, 74759, 127541, 349849, 1287731, 1294753, 3941711, 4190023, 6130739, 6310061, 6593329, 6816973, 7347709, 7573849, 8690351, 9813409, 10985959, 11703187, 12130553, 12504001, 18032059, 18468763, 20207471, 21357191, 23635603, 24301309, 25078181, 28509521, 28729567, 28855459, 30200411, 31304239
OFFSET
1,1
LINKS
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
Cf. A356765.
Sequence in context: A165711 A167369 A259161 * A242833 A242478 A247845
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Aug 26 2022
STATUS
approved