OFFSET
0,3
COMMENTS
Note that Sum_{i=0..n-1} (-k)^i / i! has a denominator that divides (n-1)! for n > 0. Therefore, for the expression to be an integer, (-k)^n / n! must have a denominator that divides (n-1)!. Thus, k^n is divisible by n, a(n) = k is divisible by A007947(n).
a(n) is the smallest integer k such that Gamma(n+1,-k)/(n!*e^k) is a positive integer, where Gamma is the upper incomplete gamma function. - Chai Wah Wu, Apr 01 2020
FORMULA
a(n) <= A034386(n).
PROG
(PARI) a(n) = {my(m = factorback(factorint(n)[, 1]), k = m); while(denominator(sum(i=2, n, (-k)^i/i!)) != 1, k += m); !n+k; }
(Python)
from functools import reduce
from operator import mul
from sympy import primefactors, factorial
def A333074(n):
f, g = int(factorial(n)), []
for i in range(n+1):
g.append(int(f//factorial(i)))
m = 1 if n < 2 else reduce(mul, primefactors(n))
k = m
while True:
p, ki = 0, 1
for i in range(n+1):
p = (p+ki*g[i]) % f
ki = (-k*ki) % f
if p == 0:
return k
k += m # Chai Wah Wu, Apr 01 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Jinyuan Wang, Mar 31 2020
EXTENSIONS
a(27)-a(35) from Chai Wah Wu, Apr 01 2020
STATUS
approved