4

Since

$$ \lim_{n\to\infty} \sum_{i=1}^n {1 \over i} = \infty $$

it should be possible to find the $n$ where the sum reaches a certain number.

Given $c$ determine $k$ where

$$ \sum_{i=1}^k {1 \over i} < c \leq \sum_{i=1}^{k+1} {1 \over i} $$

Approximate solution is also OK if you can determine whether $k$ is even or odd.

Ole Tange
  • 141

1 Answers1

3

If $S_n = \sum_{i=1}^n 1/i$, we have $L(n) < S_n < U(n)$ where $$ \eqalign{L(n) &= \ln(n) + \gamma + \frac{1}{2n} - \frac{1}{12 n^2}\cr U(n) &= \ln(n) + \gamma + \frac{1}{2n}\cr} $$

Now $U(x) = c$ for $$x = -\dfrac{1}{2 W(-\exp(\gamma-c)/2)}$$ where $W$ is the Lambert W function. If $n = \lfloor x \rfloor$, you have $U(n) \le c \le U(n+1)$. The difference between $L(n+1)$ and $U(n+1)$ is only $1/(12 (n+1)^2)$, while the difference between $U(n)$ and $U(n+1)$ is approximately $1/(n+1)$ which is much larger if $n$ is large. So for "most" $c$, you'll also have $c \le L(n+1)$, and therefore $S_{n} < c < S_{n+1}$. But if you're unlucky enough that $c > L(n+1)$, all you have is $L(n+1) < c < U(n+1)$. You might then try a better approximation.

For example, with $c = 10$, I get $x \approx 12366.46810$ so $n = 12366$, and $L(12367) \approx 10.00004301 > c$, so $S_{12366} < 10 < S_{12367}$.

Robert Israel
  • 448,999