login
a(n) = smallest positive integer k such that 1+n*k! is a prime.
8

%I #12 May 01 2016 09:11:51

%S 1,1,2,1,2,1,3,2,2,1,2,1,3,2,2,1,3,1,4,2,2,1,2,4,3,2,3,1,2,1,7,3,2,6,

%T 2,1,3,3,2,1,2,1,4,2,3,1,3,2,5,2,2,1,2,2,3,2,5,1,11,1,3,3,2,5,2,1,4,2,

%U 2,1,5,1,3,2,2,3,3,1,14,5,2,1,2,4,7,2,3,1,2,2,3,8,5,7,2,1,11,2,2,1,3,1,3

%N a(n) = smallest positive integer k such that 1+n*k! is a prime.

%F a(n) = Min{k|1+nk! is prime}.

%e n=7, 1+7.k!={8,15,43,169,...}. The smallest k which gives prime is 3 and the prime so obtained is 43.

%e n=267, the smallest k! is 31! for which 1+267*k! is prime and the prime so obtained is 65782709233423382541804503040000001.

%t spi[n_]:=Module[{k=1},While[!PrimeQ[1+k!*n],k++];k]; Array[spi,110] (* _Harvey P. Dale_, May 01 2016 *)

%o (PARI) a(n) = k = 1; while (!isprime(1+n*k!), k++); k; \\ _Michel Marcus_, Feb 20 2016

%K nonn

%O 1,3

%A _Labos Elemer_, Sep 27 2000

%E Offset corrected by _Michel Marcus_, Feb 20 2016