OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 5 is a term because the next prime is 7 and (7-5)*5*7+1 = 71 is prime.
MAPLE
R:= NULL: count := 0:
q:= 2:
while count < 100 do
p:= q; q:= nextprime(q);
if isprime((q-p)*p*q+1) then
count:= count+1;
R:= R, p;
fi
od:
R;
MATHEMATICA
Select[Range[2000], PrimeQ[#] && PrimeQ[((q = NextPrime[#]) - #) * # * q + 1] &] (* Amiram Eldar, Apr 27 2022 *)
PROG
(Python)
from itertools import islice
from sympy import isprime, nextprime
def agen(): # generator of terms
p, q = 2, 3
while True:
if isprime((q-p)*p*q+1):
yield p
p, q = q, nextprime(q)
print(list(islice(agen(), 20))) # Michael S. Branicky, Apr 27 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Apr 26 2022
STATUS
approved