%I #14 Oct 24 2021 12:28:48
%S 2,2,3,2,0,4,6,2,4,3,0,17,36,3,3,2,0,6,9,43,27,9,0,3,154,3,34,54,0,24,
%T 24,6,226,23,0,3,70,36,13,51,0,4,13,9,10,68,0,18,10,45,154,85,0,23,6,
%U 10,37,8,0,30,331,9,3,40,0,11,61,8,10,35,0,61,76,54,426,9,0,84,87,13,46
%N Least number k such that k^n + k - 1 is prime, or 0 if no such k exists.
%C If n == 5 mod 6 (A016969), k^n + k - 1 is always divisible by k^2 - k + 1. Thus it will never be prime.
%t lnk[n_]:=Module[{k=2},While[CompositeQ[k^n+k-1],k++];k]; Table[If[Mod[n,6] == 5,0,lnk[n]],{n,90}] (* _Harvey P. Dale_, Oct 24 2021 *)
%o (PARI) a(n)=if(n==Mod(5,6),return(0));k=1;while(!isprime(k^n+k-1),k++);k
%o vector(100,n,a(n))
%Y Cf. A016969, A045546, A236475, A236759, A113517.
%K nonn
%O 1,1
%A _Derek Orr_, Sep 30 2014