OFFSET
1,1
COMMENTS
These numbers when >= 31 are primes repunits 11111_n in a base n >= 2, so except 5, they are all Brazilian primes belonging to A085104. (See Links "Les nombres brésiliens", § V.4 - § V.5.) A008858 is generated by the bases n present in A049409. - Bernard Schott, Dec 19 2012
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Bernard Schott, Les nombres brésiliens, Quadrature, no. 76, avril-juin 2010, pages 30-38; included here with permission from the editors of Quadrature.
FORMULA
EXAMPLE
a(2) = 31 is prime and 31 = 2^4 + 2^3 + 2^2 + 2 + 1.
MATHEMATICA
lst={}; Do[a=1+n+n^2+n^3+n^4; If[PrimeQ[a], AppendTo[lst, a]], {n, 6!}]; lst (* Vladimir Joseph Stephan Orlovsky, Jun 02 2009 *)
Select[Table[n^4+n^3+n^2+n+1, {n, 0, 2000}], PrimeQ] (* Vincenzo Librandi, Jul 16 2012 *)
PROG
(PARI) polypn(n, p) = { for(x=1, n, if(p%2, y=2, y=1); for(m=1, p, y=y+x^m; ); if(isprime(y), print1(y", ")); ) }
(Magma) [a: n in [0..200] | IsPrime(a) where a is n^4+n^3+n^2+n+1]; // Vincenzo Librandi, Jul 16 2012
(Python)
from sympy import isprime
print(list(filter(isprime, (k**4+k**3+k**2+k+1 for k in range(120))))) # Michael S. Branicky, May 31 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Cino Hilliard, Nov 17 2003
STATUS
approved