OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..300
EXAMPLE
a(2) = 1: 6 because prime(2) = 3; 3! = 6 whose neighbors are noncomposites.
a(3) = 13: 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126.
a(4) = 11: 5040, 5041, 5042, 5043, 5044, 5045, 5046, 5047, 5048, 5049, 5050.
MAPLE
a:= n-> (f-> max(nextprime(f-1)-prevprime(f+1)-1, 0))(ithprime(n)!):
seq(a(n), n=1..52);
MATHEMATICA
b[n_] := If[n < 3, 0, NextPrime[n!] - NextPrime[n!, -1] - 1];
a[n_] := b[Prime[n]];
Array[a, 52] (* Jean-François Alcover, Jan 29 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jan 21 2021
STATUS
approved