OFFSET
1,3
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = Min{k | 1 + nk! is prime}.
EXAMPLE
For n = 7, 1 + 7*k! = {8,15,43,169,...}. The smallest k that gives prime is 3 and the obtained prime is 43.
For n = 267, the smallest k! is 31! for which 1 + 267*k! is prime and the obtained prime is 65782709233423382541804503040000001.
MATHEMATICA
spi[n_]:=Module[{k=1}, While[!PrimeQ[1+k!*n], k++]; k]; Array[spi, 110] (* Harvey P. Dale, May 01 2016 *)
PROG
(PARI) a(n) = k = 1; while (!isprime(1+n*k!), k++); k; \\ Michel Marcus, Feb 20 2016
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Labos Elemer, Sep 27 2000
EXTENSIONS
Offset corrected by Michel Marcus, Feb 20 2016
STATUS
approved