login

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”).

A245696
Least number k >= 0 such that (n!-k)/n is prime.
3
0, 4, 5, 42, 7, 8, 279, 130, 121, 156, 13, 322, 15, 752, 901, 1062, 779, 2020, 651, 682, 1679, 2136, 1825, 3874, 999, 1204, 2929, 930, 31, 1952, 33, 34, 6755, 4068, 4699, 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
OFFSET
3,2
COMMENTS
a(n) < n! for all n > 2.
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.)
LINKS
EXAMPLE
(6!-42)/6 = 113 is prime. Since 42 is the smallest number to produce a prime, a(6) = 42.
MATHEMATICA
lnk[n_]:=Module[{k=0}, While[!PrimeQ[(n!-k)/n], k++]; k]; Array[lnk, 80, 3] (* Harvey P. Dale, Jan 30 2023 *)
PROG
(PARI)
a(n)=for(k=0, 10^6, s=(n!-k)/n; if(floor(s)==s, if(ispseudoprime(s), return(k))))
n=3; while(n<100, print1(a(n), ", "); n++)
CROSSREFS
KEYWORD
nonn
AUTHOR
Derek Orr, Jul 29 2014
STATUS
approved