login
A274525
Prime numbers p such that p - 2, p^2 - p - 1, p^2 - p + 1 are prime numbers.
2
7, 139, 1789, 2731, 4159, 5641, 13339, 13399, 19429, 21739, 22369, 32059, 32911, 33601, 42571, 45319, 54541, 55339, 65449, 68821, 106189, 108499, 111871, 132859, 136399, 138079, 141511, 142981, 148201, 149629, 152041, 152839, 173431, 174049, 178249
OFFSET
1,1
EXAMPLE
5 - 2 = 3 prime, 5 prime, 5*(5-1) - 1 = 19 prime, 5*(5-1) + 1 = 21 composite, so 5 is not in the sequence.
7 - 2 = 5 prime, 7 prime, 7*(7-1) - 1 = 41 prime, 7*(7-1) + 1 = 43 prime so 7 is in the sequence.
MATHEMATICA
Select[Prime[Range[100]], Union[PrimeQ[{# - 2, #^2 - # - 1, #^2 - # + 1}]] == {True} &] (* Alonso del Arte, Jun 27 2016 *)
Select[Prime[Range[17000]], AllTrue[{#-2, #^2-#-1, #^2-#+1}, PrimeQ]&] (* Harvey P. Dale, Jun 20 2024 *)
PROG
(PFGW & SCRIPT) twin.txt file with the smallest of twin pairs.
SCRIPT
DIM n
OPENFILEIN maf, twin.txt
OPENFILEOUT myf, a.txt
LABEL loop
GETNEXT n, maf
SET n, n+2
SET m, n*(n-1)-1
PRP m
IF ISPRP THEN GOTO a
GOTO loop
LABEL a
PRP m+2
IF ISPRP THEN WRITE myf, n
GOTO loop
(PARI) lista(nn) = forprime(p=2, nn, if (isprime(p-2) && isprime(p^2-p-1) && isprime(p^2-p+1), print1(p, ", "))); \\ Michel Marcus, Jul 07 2016
(Python)
from sympy import isprime, primerange
def aupto(n):
t = []
for p in primerange(2, n+1):
if isprime(p-2) and isprime(p**2 - p - 1) and isprime(p**2 - p + 1):
t.append(p)
return t # Paul Muljadi, Jun 21 2024
CROSSREFS
Cf. A228968.
Sequence in context: A142295 A056254 A137463 * A221375 A351334 A190195
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jun 27 2016
STATUS
approved