%I #10 Dec 17 2016 11:06:17
%S 1,1,2,1,2,1,5,2,3,1,10,1,3,2,2,1,2,1,5,2,2,1,18,2,3,6,2,1,9,1,12,7,2,
%T 3,8,1,74,2,5,1,2,1,14,3,6,1,9,18,3,2,3,1,3,2,19,3,2,1,2,1,3,2,115,5,
%U 6,1,16,5,2,1,2,1,5,3,2,3,2,1,6,2,6,1,3,3,10,3,5,1,2,2,3,24,8,3,13,1,13,3,2
%N Smallest k such that n(n+1)(n+2)...(n+k-1)+1 is prime.
%F a(n) = A087565(n) + 1. - _Filip Zaludek_, Dec 16 2016
%e a(2)=1 because 2+1=3 is a prime. a(3)=2 because 3+1=4 is not a prime, but 3*4+1=13 is a prime. a(9)=3 because neither 9+1=10 nor 9*10+1=91=13*7 is a prime, but 9*10*11+1=991 is.
%t a[n_] := Block[{}, For[s = n; k = 1, ! PrimeQ[s + 1], s *= n + k; k++ ]; k] Table[a[n], {n, 1, 100}]
%t (* Second program *)
%t Table[k = 1; While[! PrimeQ[1 + Pochhammer[n, k]], k++]; k, {n, 99}] (* _Michael De Vlieger_, Dec 17 2016 *)
%o (PARI) a(n)=my(N=n,k=n);while(!ispseudoprime(N+1),N*=k++);k-n+1 \\ _Charles R Greathouse IV_, May 15 2013
%Y Cf. A087564.
%K nonn
%O 1,3
%A Cheng Zhang (cz1(AT)rice.edu), Jan 26 2010