login
A333073
Least k such that Sum_{i=1..n} (-k)^i / i is a positive integer.
2
1, 2, 6, 6, 30, 20, 140, 140, 210, 42, 462, 462, 12012, 3432, 6006, 6006, 87516, 87516, 1108536, 3048474, 2586584, 2586584, 44618574, 44618574, 60843510, 17160990, 17160990, 14263680, 782050830, 782050830, 3806842470, 3806842470, 16830250920, 16830250920
OFFSET
1,2
COMMENTS
Note that the denominator of (Sum_{i=1..n} (-k)^i/i) - (-k)^p/p can never be divisible by p, where n/2 < p <= n. Therefore, for the expression to be an integer, such p must divide k. Thus, a(n) = k is divisible by A055773(n).
LINKS
FORMULA
a(n) <= A034386(n).
PROG
(PARI) a(n) = {my(m = prod(i=primepi(n/2)+1, primepi(n), prime(i)), k = m); while(denominator(sum(i=2, n, (-k)^i/i)) != 1, k += m); k; }
(Python)
from sympy import primorial, lcm
def A333073(n):
f = 1
for i in range(1, n+1):
f = lcm(f, i)
f = int(f)
glist = []
for i in range(1, n+1):
glist.append(f//i)
m = 1 if n < 2 else primorial(n, nth=False)//primorial(n//2, nth=False)
k = m
while True:
p, ki = 0, -k
for i in range(1, n+1):
p = (p+ki*glist[i-1]) % f
ki = (-k*ki) % f
if p == 0:
return k
k += m # Chai Wah Wu, Apr 02 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Jinyuan Wang, Mar 31 2020
STATUS
approved