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.

A057683 Numbers k such that k^2 + k + 1, k^3 + k + 1 and k^4 + k + 1 are all prime.

Original entry on oeis.org

1, 2, 5, 6, 12, 69, 77, 131, 162, 426, 701, 792, 1221, 1494, 1644, 1665, 2129, 2429, 2696, 3459, 3557, 3771, 4350, 4367, 5250, 5670, 6627, 7059, 7514, 7929, 8064, 9177, 9689, 10307, 10431, 11424, 13296, 13299, 13545, 14154, 14286, 14306, 15137
Offset: 1

Views

Author

Harvey P. Dale, Oct 20 2000

Keywords

Comments

After a(0) = 1, k^5 + k + 1 is never prime. Proof: k^5 + k + 1 = (k^2 + k + 1)*(k^3 - k^2 + 1). - Jonathan Vos Post, Oct 17 2007, edited by Robert Israel, Aug 01 2016
For n > 1, no terms == 1 (mod 3) or == 3 (mod 5). - Robert Israel, Jul 31 2016

Examples

			5 is included because 5^2 + 5 + 1 = 31, 5^3 + 5 + 1 = 131 and 5^4 + 5 + 1 = 631 are all prime.
		

Crossrefs

Cf. A049407.
Cf. Subsequence of A219117; A010051.

Programs

  • Haskell
    a057683 n = a057683_list !! (n-1)
    a057683_list = filter (all (== 1) . p) [1..] where
       p x = map (a010051 . (+ (x + 1)) . (x ^)) [2..4]
    -- Reinhard Zumkeller, Nov 12 2012
    
  • Magma
    [n: n in [0..20000]|IsPrime(n^2+n+1) and IsPrime(n^3+n+1) and IsPrime(n^4+n+1)] // Vincenzo Librandi, Dec 20 2010
    
  • Maple
    select(n -> isprime(n^4+n+1) and isprime(n^3+n+1) and isprime(n^2+n+1), [$1..50000]); # Robert Israel, Jul 31 2016
  • Mathematica
    Select[Range[16000],And@@PrimeQ/@(Table[n^i+n+1,{i,2,4}]/.n->#)&]  (* Harvey P. Dale, Mar 28 2011 *)
  • Python
    from sympy import isprime
    A057683_list = [n for n in range(10**5) if isprime(n**2+n+1) and isprime(n**3+n+1) and isprime(n**4+n+1)] # Chai Wah Wu, Apr 02 2021