login
a(n) is the smallest m such that n!-m and n!+m are both primes.
5

%I #17 Jul 30 2014 09:17:35

%S 0,1,5,7,19,19,31,17,11,17,83,67,353,227,163,59,61,113,353,31,1447,

%T 571,389,191,337,883,101,1823,659,709,163,1361,439,307,1093,1733,2491,

%U 1063,1091,1999,1439,109,2753,607,2617,269,103,2663,337,14447,2221,5471,2887

%N a(n) is the smallest m such that n!-m and n!+m are both primes.

%C 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.

%C According to Goldbach's conjecture, a(n) always exists with a(n) = A047160(n!). - _Jens Kruse Andersen_, Jul 30 2014

%H Vincenzo Librandi, <a href="/A075409/b075409.txt">Table of n, a(n) for n = 2..100</a>

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

%t 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 *)

%o (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

%Y Cf. A033932, A033933, A047160, A053709, A075468, A075410.

%K nonn

%O 2,3

%A _Zak Seidov_, Sep 18 2002

%E More terms from _David Wasserman_, Jan 17 2005