%I #9 Jul 15 2023 13:18:40
%S 4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,
%T 31,32,33,34,35,36,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,
%U 56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,74,75,76,78,79,80
%N Numbers n such that all numbers between the largest prime preceding n! and the smallest prime following n! + n are composite.
%e For n = 7 there are 11 consecutive primes (5040-5050) between primes 5039 and 5051. 7 is the 4th entry in the sequence. 11 does not appear because 11!+1 is prime.
%t allCompQ[n_]:=Module[{nf=n!},AllTrue[Range[NextPrime[nf,-1]+1,NextPrime[nf+n]-1],CompositeQ]]; Select[Range[80],allCompQ] (* _Harvey P. Dale_, Jul 15 2023 *)
%o (PARI) factgaps2(m) = { for(n=2,m, c=0; f=0; nf=n!; for(x=precprime(nf),nextprime(nf+n), if(isprime(nf+1),f=1; break); if(!isprime(x),c++) ); if(f==0,print1(n",")) ) }
%K nonn
%O 1,1
%A _Cino Hilliard_, Nov 06 2003
%E More terms from _Ray Chandler_, Nov 09 2003
|