OFFSET
2,5
COMMENTS
Equivalently, a(n) = n!*prime(n) minus the previous prime.
FORMULA
a(n) = n!*prime(n) - A007917(n!*prime(n)).
EXAMPLE
For n=3, n!*prime(n) = 3!*prime(3) = 6*5 = 30, and the largest prime < 30 is 29, so a(3) = 30 - 29 = 1.
MATHEMATICA
Table[With[{c=n!Prime[n]}, c-NextPrime[c, -1]], {n, 2, 70}] (* Harvey P. Dale, Sep 01 2024 *)
PROG
(PARI) a(n) = my(x=n!*prime(n)); x - precprime(x); \\ Michel Marcus, Feb 22 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Mohamed Sami Gattoufi, Feb 21 2020
STATUS
approved