login
A349336
Primes p such that p+2, p*(p+1)/2-2 and p*(p+1)/2+2 are also primes.
1
5, 41, 149, 281, 641, 1301, 1481, 3329, 3821, 4421, 5849, 6761, 10529, 12161, 17489, 32969, 36341, 41609, 43889, 51341, 63389, 64661, 67409, 70121, 84629, 89069, 94529, 104309, 108881, 129401, 138569, 139589, 161561, 161741, 163169, 166601, 174929, 176609, 190889, 198221, 203321, 206909, 215141
OFFSET
1,1
COMMENTS
All terms == 5 (mod 12).
LINKS
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
Subsequence of A001359.
Sequence in context: A337393 A262340 A128347 * A056905 A105412 A271017
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Nov 15 2021
STATUS
approved