login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A333074
Least k such that Sum_{i=0..n} (-k)^i / i! is a positive integer.
2
1, 1, 2, 3, 4, 30, 6, 28, 120, 84, 210, 1650, 210, 11440, 6930, 630, 9240, 353430, 93450, 746130, 1616160, 746130, 1021020, 11104170, 56705880, 9722790, 48498450, 174594420, 87297210, 222071850, 2114532420, 11480905800, 5375910540, 42223261080, 5603554110, 2043061020
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