Is there a formulaic way to go from $\sum_{k=1}^{n} \frac{1}{k}$ back to $n$?

262 Views Asked by At

Say you want to sum $g(n) = \sum_{k=1}^{n} \frac{1}{k} = L$. Is there a simple formula to go from $L$ and deduce $n$?

My attempt:

For $n = 1$, the formula is $L$.

Assume there is a formula for all $n=1..N$ say $f(L)$. Then we have $g(N+1) = g(N) + \frac{1}{N+1}$, $\frac{g(N)(N+1) + 1}{N+1} = L$. $(N+1)(L - g(N)) = 1$. No hope.

4

There are 4 best solutions below

0
On BEST ANSWER

You can approximate $n$ from $L$. An overestimate is $h_n \approx \ln(n)+c+\frac{1}{n}$. where $c \approx 0.577$.

From here $$h_n-c \approx \ln(n)+1/n$$

But $$\frac{\ln(n+h)-\ln(n)}{h} \approx 1/n$$ for $h$ close to zero. So $$\ln(n+1)-\ln(n) \approx 1/n$$.

Thus,

$$h_n-c \approx \ln(n)+\ln(n+1)-\ln(n)$$ This is still valid as an overestimate for $n>e^{1-c}-1$ the intersection of noncontinuous $h_n$ (when it's graphed using steps) and $\ln(n+1)+c$. But we only care for $n \geq 1$ so we should be good.

Let $h_n=L$

$$e^{L-c} \approx n+1$$

$$e^{L-c}-1 \approx n$$

An underestimate to the harmonic series is:

$$L=h_n \approx \ln(n)+c$$

$$e^{L-c} \approx n$$

Now

$$e^{L-c}-1 < n < e^{L-c}$$

If you want to see how these approximation formulas are derived click on my profile, it should be one of my top questions titled "an approach to approximating the harmonic series".

6
On

Given that $n$ is an integer, you know that $\sum_{k=1}^n \frac{1}{k} \approx \ln n+\gamma+\frac1{2n}-O(n^{-2})$ ($\gamma$ is the Euler-Mascheroni constant) so you could probably use that.

0
On

As already said in answers and comments, for large values of $n$ $$ \sum_{k=1}^{n} \frac{1}{k}=H_n\approx \frac{1}{2 n}+\log(n)+\gamma$$ Now, the solution of $$\frac{1}{2 n}+\log(n)+\gamma=L$$ can be expressed using Lambert function $$n=-\frac{1}{2 W\left(-\frac{e^{\gamma -L}}{2}\right)}$$ Since we consider large values of $n$, the argument of Lambert function is small and we can use the approximation $$W(x)=\sum_{n=1}^\infty \frac{(-n)^{n-1}}{n!}x^n=x-x^2+\frac 32 x^3+\cdots$$ and then, $$n\approx e^{L-\gamma}-\frac 12 -\frac 1{8 e^{L-\gamma}}$$

For illustration purposes, let us consider $n=10$ which gives $L=\frac{7381}{2520}$; the approximation formula will give $n=9.99206$ which is not too bad.

Consider $L=10$; the above approximation would give $n\approx 12366.5$ while $H_{12366}\approx 9.9999621$ and $H_{12367}\approx 10.000043$.

1
On

$$\sum_{k=1}^{n} \frac{1}{k}=\psi(n+1)+\gamma$$

Where $\psi(x)$ is digamma function.

So to find $n$ you have to employ inverse digamma function.

$$n=\psi^{inverse}(L-\gamma)-1$$

Here is a way to define it in Mathematica: https://mathematica.stackexchange.com/questions/89107/inverse-of-a-digamma-polygamma-function