cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A274525 Prime numbers p such that p - 2, p^2 - p - 1, p^2 - p + 1 are prime numbers.

Original entry on oeis.org

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

Views

Author

Pierre CAMI, Jun 27 2016

Keywords

Examples

			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.
		

Crossrefs

Cf. A228968.

Programs

  • 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 *)
  • 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