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”).
%I #11 Apr 10 2016 10:16:34
%S 3,1,3,1,3,1,1,1,3,1,2,1,1,1,3,1,2,1,1,1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,
%T 3,1,1,1,3,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,3,1,1,1,
%U 2,1,2,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,2,1,2,1,1,1,2
%N Smallest k>0 such that n^k + 1 is not prime.
%C a(odd) = 1.
%C Since n + 1 divides n^3 + 1, a(n) <= 3. - _Robert Israel_, Jun 15 2014
%H Robert Israel, <a href="/A102368/b102368.txt">Table of n, a(n) for n = 2..10000</a>
%e n=10: 10^1+1=11=A000040(5), 10^2+1=101=A000040(26), but 10^3+1=1001=7*11*13, therefore a(10)=3.
%p A102368:= proc(n)
%p if n::odd or not isprime(n+1) then 1
%p elif isprime(n^2+1) then 3 else 2
%p fi
%p end proc; # _Robert Israel_, Jun 15 2014
%t sk[n_]:=Module[{k=1},While[PrimeQ[n^k+1],k++];k]; Array[sk,110,2] (* _Harvey P. Dale_, Apr 09 2016 *)
%Y Cf. A070689: a(n) = 3.
%K nonn
%O 2,1
%A _Reinhard Zumkeller_, Feb 22 2005