OFFSET
1,1
COMMENTS
p-n! where p = nextprime(nextprime(n!)).
Is every term a prime?
LINKS
Clark Kimberling, Table of n, a(n) for n = 1..300
FORMULA
EXAMPLE
For n = 4, we have n! = 24, so that p = 31 and a(4) = 7.
MATHEMATICA
Table[NextPrime[n!, 2] - n!, {n, 1, 150}]
PROG
(PARI) a(n) = nextprime(nextprime(n!+1)+1) - n!; \\ Michel Marcus, Mar 05 2022
(Python)
from sympy import factorial, nextprime
def a(n): fn = factorial(n); return nextprime(nextprime(fn)) - fn
print([a(n) for n in range(1, 60)]) # Michael S. Branicky, Mar 05 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Jul 23 2016
STATUS
approved