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 #14 Jan 30 2023 12:30:29
%S 0,4,5,42,7,8,279,130,121,156,13,322,15,752,901,1062,779,2020,651,682,
%T 1679,2136,1825,3874,999,1204,2929,930,31,1952,33,34,6755,4068,4699,
%U 3686,39,2920,3403,5502,3397,4796,4905,2438,4183,3792,5047,2950,4947,9308,3551,3186,6985,3416,26277,16066,6431,8220,8479,4402,4473,6464,23335,8382,21239,12988,17319,7210,6887,54072,11899,27602
%N Least number k >= 0 such that (n!-k)/n is prime.
%C a(n) < n! for all n > 2.
%C a(n) = n times (least m >= 0 such that (n-1)!-m is prime) = n*A033933(n-1). - _Jens Kruse Andersen_, Jul 30 2014 (This shows that a(n) always exists.)
%H Jens Kruse Andersen, <a href="/A245696/b245696.txt">Table of n, a(n) for n = 3..2001</a>
%e (6!-42)/6 = 113 is prime. Since 42 is the smallest number to produce a prime, a(6) = 42.
%t lnk[n_]:=Module[{k=0},While[!PrimeQ[(n!-k)/n],k++];k]; Array[lnk,80,3] (* _Harvey P. Dale_, Jan 30 2023 *)
%o (PARI)
%o a(n)=for(k=0,10^6,s=(n!-k)/n;if(floor(s)==s,if(ispseudoprime(s),return(k))))
%o n=3;while(n<100,print1(a(n),", ");n++)
%Y Cf. A033933, A245695, A245697.
%K nonn
%O 3,2
%A _Derek Orr_, Jul 29 2014