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 #12 Jan 14 2022 14:21:56
%S 2,3,5,23,113,719,5039,40343,362867,3628789,39916801,479001599,
%T 6227020777,87178291199,1307674368043,20922789888023,355687428096031,
%U 6402373705728037,121645100408832089,2432902008176640029
%N Nearest prime to n! (but not equal to n!).
%C If n! is the average of its closest prime neighbors then the smaller prime is to be chosen (as in A051701).
%e For 8!=40320 the closest upper and lower primes are 40289 and 40343 with d=31 and d=23, so 40343 is closer to 8! than the lower neighbor.
%t f[n_]:=Module[{nf=n!,s,l},s=NextPrime[nf,-1];l=NextPrime[nf];If[nf-s>l-nf,l,s]]
%t Table[f[i],{i,25}] (* _Harvey P. Dale_, Dec 08 2010 *)
%Y Cf. A000142, A033932, A037151, A033933, A006990.
%K nonn
%O 1,1
%A _Labos Elemer_, Feb 10 2000
%E Corrected by _Rick L. Shepherd_, Jan 11 2006