|
|
A333072
|
|
Least k such that Sum_{i=1..n} k^i / i is a positive integer.
|
|
3
|
|
|
1, 2, 6, 6, 30, 10, 70, 70, 210, 168, 1848, 1848, 18018, 8580, 2574, 2574, 102102, 102102, 831402, 2771340, 3233230, 587860, 43266496, 117630786, 162249360, 145088370, 145088370, 2897310, 672175920, 672175920, 18232771830, 18232771830, 44279588730, 8886561060
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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
f = 1
for i in range(1, n+1):
f = lcm(f, i)
f, glist = int(f), []
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|