OFFSET
1,1
COMMENTS
All terms == 5 (mod 12).
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 149 is a term because 149, 151, 149*150/2-2 = 11173 and 149*150/2+2 = 11177 are prime.
MAPLE
filter:= proc(n) local q;
if not (isprime(n) and isprime(n+2)) then return false fi;
q:= n*(n+1)/2;
isprime(q-2) and isprime(q+2);
end proc:
select(filter, [seq(i, i=5..10^6, 12)]); # Robert Israel, Nov 15 2021
MATHEMATICA
Select[12 * Range[0, 18000] + 5, And @@ PrimeQ[{#, # + 2, #*(# + 1)/2 - 2, #*(# + 1)/2 + 2}] &] (* Amiram Eldar, Nov 15 2021 *)
PROG
(Python)
from sympy import isprime, primerange
def ok(p):
return isprime(p+2) and all(isprime(p*(p+1)//2 + k) for k in [-2, 2])
def aupto(limit):
return [p for p in primerange(1, limit+1) if ok(p)]
print(aupto(215141)) # Michael S. Branicky, Nov 16 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Nov 15 2021
STATUS
approved