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.
%I A072883 #31 Jul 07 2024 20:50:44 %S A072883 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, %T A072883 1,110,1,232,117,230,3,12,1,4,375,2,1,48,1,46,15,218,1,78,7,100,993, %U A072883 28,1,624,13,252,183,226,1,104,1,1348,777,1294,0,1806,1,306,1815,10,1,30,1 %N A072883 Least k >= 1 such that k^n + n is prime, or 0 if no such k exists. %C A072883 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 %H A072883 Hugo Pfoertner, <a href="/A072883/b072883.txt">Table of n, a(n) for n = 1..756</a> %t A072883 Table[If[MemberQ[{27, 64}, n], 0, k=1; While[ !PrimeQ[k^n+n], k++ ]; k], {n, 100}] %t A072883 (* Second program: *) %t A072883 okQ[n_] := n == 4 || IrreduciblePolynomialQ[x^n + n]; %t A072883 a[n_] := If[!okQ[n], 0, s = 1; While[!PrimeQ[s^n + n], s++]; s]; %t A072883 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Jan 15 2019, from PARI *) %o A072883 (PARI) isok(n) = (n==4) || polisirreducible(x^n+n); %o A072883 a(n) = if (!isok(n), 0, my(s=1); while(!isprime(s^n+n), s++); s); \\ adapted by _Michel Marcus_, Jan 15 2019 %o A072883 (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 %o A072883 (Python) %o A072883 from sympy import isprime %o A072883 def A072883(n): %o A072883 if is_A097792(n): return int(n==4) %o A072883 for k in range(1,99**9): %o A072883 if isprime(k**n+n): return k # _M. F. Hasler_, Jul 07 2024 %Y A072883 Cf. A097792 (n such that x^n + n is reducible). %Y A072883 Cf. A239666, A303121, A303122. %K A072883 nonn %O A072883 1,3 %A A072883 _Benoit Cloitre_, Aug 13 2002 %E A072883 More terms from _T. D. Noe_, Aug 24 2004