OFFSET
2,1
COMMENTS
k can never be 8,14,20,... (k=2 mod 6) because, for those k, n^k-n+1 has the factor n^2-n+1, which is >1 for n>1. Using a result of Selmer, it can be shown that the polynomial x^k-x+1 is irreducible for all other k. The term a(93) is greater than 60000. Does a(n) exist for all n>1?
LINKS
Ernst S. Selmer, On the irreducibility of certain trinomials, Mathematica Scandinavica (1956), Volume: 4, page 287-302.
MATHEMATICA
Table[k=1; While[ !PrimeQ[n^k-n+1], k++ ]; k, {n, 2, 92}]
PROG
(PARI) a(n) = my(k=1); while (!isprime(n^k-n+1), k++); k; \\ Michel Marcus, Nov 20 2021
(Python)
from sympy import isprime
def a(n):
k = 2
while not isprime(n**k - n + 1): k += 1
return k
print([a(n) for n in range(2, 71)]) # Michael S. Branicky, Nov 20 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
T. D. Noe, Jan 12 2006
STATUS
approved