OFFSET

2,3

COMMENTS

For n=3,5,10,21,171,190,348, n! is an interprime, the average of two consecutive primes, see A053709. In general n! may be average of several pairs of primes, in which case the minimal distance is in the sequence. See also n^n and n!! as average of two primes in A075468 and A075410.

According to Goldbach's conjecture, a(n) always exists with a(n) = A047160(n!). - Jens Kruse Andersen, Jul 30 2014

LINKS

Vincenzo Librandi, Table of n, a(n) for n = 2..100

EXAMPLE

a(4)=5 because 4!=24 and 19 and 25 are primes with smallest distance 5 from 4!.

MATHEMATICA

smp[n_]:=Module[{m=1, nf=n!}, While[!PrimeQ[nf+m]||!PrimeQ[nf-m], m=m+2]; m]; Join[{0}, Array[smp, 60, 3]] (* Harvey P. Dale, Apr 18 2014 *)

PROG

(PARI) a(n) = {my (m=0); until (ok, ok = isprime(n!-m) && isprime(n!+m); if (!ok, m++); ); return (m); } \\ Michel Marcus, Apr 19 2013

CROSSREFS

KEYWORD

nonn

AUTHOR

Zak Seidov, Sep 18 2002

EXTENSIONS

More terms from David Wasserman, Jan 17 2005

STATUS

approved