login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A072883
Least k >= 1 such that k^n + n is prime, or 0 if no such k exists.
8
1, 1, 2, 1, 2, 1, 16, 3, 2, 1, 32, 1, 118, 417, 2, 1, 14, 1, 22, 81, 76, 1, 12, 55, 28, 15, 0, 1, 110, 1, 232, 117, 230, 3, 12, 1, 4, 375, 2, 1, 48, 1, 46, 15, 218, 1, 78, 7, 100, 993, 28, 1, 624, 13, 252, 183, 226, 1, 104, 1, 1348, 777, 1294, 0, 1806, 1, 306, 1815, 10, 1, 30, 1
OFFSET
1,3
COMMENTS
Because the polynomial x^n + n is reducible for n in A097792, a(27) and a(64) are 0. Although x^4 + 4 is reducible, the factor x^2 - 2x + 2 is 1 for x=1. - T. D. Noe, Aug 24 2004
LINKS
MATHEMATICA
Table[If[MemberQ[{27, 64}, n], 0, k=1; While[ !PrimeQ[k^n+n], k++ ]; k], {n, 100}]
(* Second program: *)
okQ[n_] := n == 4 || IrreduciblePolynomialQ[x^n + n];
a[n_] := If[!okQ[n], 0, s = 1; While[!PrimeQ[s^n + n], s++]; s];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 15 2019, from PARI *)
PROG
(PARI) isok(n) = (n==4) || polisirreducible(x^n+n);
a(n) = if (!isok(n), 0, my(s=1); while(!isprime(s^n+n), s++); s); \\ adapted by Michel Marcus, Jan 15 2019
(PARI) apply( {A072883(n)=if(is_A097792(n), n==4, for(k=1, oo, ispseudoprime(k^n+n) && return(k)))}, [1..99]) \\ M. F. Hasler, Jul 07 2024
(Python)
from sympy import isprime
def A072883(n):
if is_A097792(n): return int(n==4)
for k in range(1, 99**9):
if isprime(k**n+n): return k # M. F. Hasler, Jul 07 2024
CROSSREFS
Cf. A097792 (n such that x^n + n is reducible).
Sequence in context: A295853 A287541 A288196 * A093101 A082469 A206566
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Aug 13 2002
EXTENSIONS
More terms from T. D. Noe, Aug 24 2004
STATUS
approved