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

%I #44 Feb 17 2022 00:42:51

%S 1,2,5,6,12,69,77,131,162,426,701,792,1221,1494,1644,1665,2129,2429,

%T 2696,3459,3557,3771,4350,4367,5250,5670,6627,7059,7514,7929,8064,

%U 9177,9689,10307,10431,11424,13296,13299,13545,14154,14286,14306,15137

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

%C 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

%C For n > 1, no terms == 1 (mod 3) or == 3 (mod 5). - _Robert Israel_, Jul 31 2016

%H Reinhard Zumkeller and Robert Israel, <a href="/A057683/b057683.txt">Table of n, a(n) for n = 1..10000</a> (n = 1..100 from Reinhard Zumkeller).

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

%p 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

%t Select[Range[16000],And@@PrimeQ/@(Table[n^i+n+1,{i,2,4}]/.n->#)&] (* _Harvey P. Dale_, Mar 28 2011 *)

%o (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

%o (Haskell)

%o a057683 n = a057683_list !! (n-1)

%o a057683_list = filter (all (== 1) . p) [1..] where

%o p x = map (a010051 . (+ (x + 1)) . (x ^)) [2..4]

%o -- _Reinhard Zumkeller_, Nov 12 2012

%o (Python)

%o from sympy import isprime

%o 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

%Y Cf. A049407.

%Y Cf. Subsequence of A219117; A010051.

%K easy,nice,nonn

%O 1,2

%A _Harvey P. Dale_, Oct 20 2000