OFFSET
1,5
COMMENTS
a(n) = 1 iff n+1 is prime.
For n > 2, in order for (n!+k)/(n+k) to be an integer, the smallest integer possible is 2. Thus, a(n) <= n!-2n for all n > 2.
Let q = (n!+k)/(n+k). Then, k = (n!-n)/(q-1)-n. So, a(n) = d-n, where d is the smallest divisor (> n) of n!-n. (for all n >= 4) - Hiroaki Yamanouchi, Sep 29 2014
LINKS
Hiroaki Yamanouchi, Table of n, a(n) for n = 1..79
EXAMPLE
(6!+1)/(6+1) = 103 is an integer. Thus a(6) = 1.
PROG
a(n)=for(k=1, 10^5, s=(n!+k)/(n+k); if(floor(s)==s, return(k)));
n=1; while(n<100, print(a(n)); n+=1)
CROSSREFS
KEYWORD
nonn
AUTHOR
Derek Orr, May 17 2014
EXTENSIONS
a(13), a(15), a(21), a(25), a(31) and a(33) from Hiroaki Yamanouchi, Sep 29 2014
STATUS
approved