# Summing Finitely Many Terms of Harmonic Series: $\sum_{k=a}^{b} \frac{1}{k}$

How do I calculate sum of a finite harmonic series of the form :

$$\sum_{k=a}^{b} \frac{1}{k} = \frac{1}{a} + \frac{1}{a+1} + \frac{1}{a+2} +\cdots \frac{1}{b}.$$

Is there a general formula for this? How can we approach this if not?

• You can find good estimates of the $n$-th harmonic number here. – André Nicolas Jul 8 '13 at 20:50
• An approximation is given by $log\left(\frac{2b+1}{2a-1}\right)$ – Jaume Oliver Lafont Jan 6 '16 at 0:36

## 7 Answers

You can't find a general formula. All you can do is the use the standard asymptotic formula for the harmonic sum

$$H_n = \sum_{k=1}^n \frac1k = \ln n + \gamma +\frac1{2n} -\frac1{12n^2} + \frac1{120n^4} + ...$$

where $\gamma \approx 0.5772156649$ is the Euler–Mascheroni constant.

Your sum would be $H_b - H_{a-1}$.

• A better asymptotic formula is given by $$H_n=log\left(n+\frac{1}{2}\right)+\gamma+\frac{1}{24n^2}-\frac{1}{24n^3}+...$$ $$H_n=log\left(2n+1\right)-log\left(2\right)+\gamma+\frac{1}{24n^2}-\frac{1}{24n^3}+...$$ General closed form formulas can be found here: math.stackexchange.com/a/1602945/134791 – Jaume Oliver Lafont Jan 9 '16 at 23:38
• Yup. And the $n+1/2$ form works better the Stirling's usual formula for $n!$ also. btw, your two forms are the same, of course. – marty cohen Jan 10 '16 at 4:55
• I think they deserve being written separately because there are two different comparisons: $H_n$ approximates better $log(n+\frac{1}{2})$ than $log(n)$ because $$\frac{1}{24n^2}<\frac{1}{2n}$$ $H_n$ approximates better $log\left(2n+1\right)$ than $log\left(n+\frac{1}{2}\right)$ because $$lim_{n \to \infty}\left(log\left(2n+1\right)-H_n\right)=log(2)-\gamma<\gamma=lim_{n \to \infty}\left(H_n-log\left(n+\frac{1}{2}\right)\right)$$ – Jaume Oliver Lafont Jan 10 '16 at 6:50

Let $H_{x} = \frac{1}{1}+\frac{1}{2}+\frac{1}{3}+\cdots+\frac{1}{x}$.

So if I'm not wrong, what you are looking for is, $H_{b}−H_{a - 1}$

The first term may be taken out of the generalized Mercator series for the logarithm of integers https://math.stackexchange.com/a/1593145/134791

$$log\left(n\right)=\sum_{k=0}^{\infty}\left(\sum_{i=nk+1}^{n(k+1)}\frac{1}{i}-\frac{1}{k+1}\right)$$

to obtain $$log\left(n\right)=H_n-1+\sum_{k=1}^{\infty}\left(\sum_{i=nk+1}^{n(k+1)}\frac{1}{i}-\frac{1}{k+1}\right)$$

For odd arguments, partial sums are closer to the limit if the following regrouping is chosen

$$log(2n+1)=H_n+\sum_{k=1}^{\infty}\left(\sum_{i=-n}^{n}\frac{1}{(2n+1)k+i}-\frac{1}{k}\right)$$

This leads to the approximation $$log(2n+1)\approx H_n$$

which combined with Fallen's answer finally yields $$\sum_{k=a}^b\frac{1}{k}\approx log\left(\frac{2b+1}{2a-1}\right)$$

as claimed in my previous comment.

This approximation can also be obtained from a geometrical approximation to the integral of $\frac{1}{x}$. Let each term represent a rectangle with height $\frac{1}{k}$ and unit width centered around $x=k$:

$$\frac{1}{k} \approx \int_{k-\frac{1}{2}}^{k+\frac{1}{2}}\frac{dx}{x}$$

Now adding $b-a+1$ of such consecutive approximations the same result is obtained. $$\sum_{k=a}^b\frac{1}{k}\approx \int_{a-\frac{1}{2}}^{b+\frac{1}{2}}\frac{dx}{x}=log\left(b+\frac{1}{2}\right)-log\left(a-\frac{1}{2}\right)=log\left(\frac{b+\frac{1}{2}}{a-\frac{1}{2}}\right)=log\left(\frac{2b+1}{2a-1}\right)$$

• Just noticed this answer. Nice. But, wouldn't the approximation be $log(2n+1)\approx H_n+\log(2)$? – marty cohen Jul 28 at 22:17
• The expansion for $\log(2n+1)-H_n$ starts $(\log(2) - \gamma ) - \frac{1}{24 n^2} + \frac{1}{24 n^3}$, so we also have $log(2n+1) \approx H_n+\log(2)-\gamma$. – Jaume Oliver Lafont Jul 29 at 6:00

This answer is more for additional information and as an exercise for myself to remember Gosper's algorithm.

There is no nice closed formula for this. By nice we can take hypergeometric functions (functions $f(n)$ such that $f(n+1)/f(n)$ is a rational function) or even finite sums of hypergeometric functions. If there were, in particular you would get a nice closed formula for $H(n):=1+1/2+1/3+...+1/n$.

Assume that $H(n)$ is hypergeometric. Then $1/n=H(n)-H(n-1)$, i.e. $$nH(n)-nH(n-1)=1$$.

Now, since we are assuming $H$ is hypergeometric we get $$nH(n)=\frac{H(n)}{(H(n+1)-H(n))}=\frac{1}{\frac{H(n+1)}{H(n)}-1},$$

which should be rational. So, we are looking for a rational function $K(n):=nH(n)$ such that

$$(n-1)K(n)-nK(n-1)=n-1.$$

Observe that if $a\neq1$ is a pole of $K(n)$ then it would have to be a pole of $K(n-1)$. If $1$ is a pole of $K$ then $-2$ is a pole of $K(n-1)$ and therefore also a pole of $K$. This is impossible because it implies $K$ has infinitely many poles. Therefore $K$ is a polynomial. But there are no polynomials satisfying this equation. In fact, assume $K(n)=an^r+bn^{r-1}+\ldots$. Plug it in the equation and you get that the leading term of the left hand side is $(r-1)an^r$. Therefore we get that $r=1$ and $(r-1)a=1$ from imposing that it should be equal to the right hand side $n-1$. But these equations are impossible.

Thus $H$ is not an hypergeometric function. Further arguments show that it can't be either a finite sum of hypergeometric functions.

You can use unsigned Sterling's numbers of the first kind that is A$000254$ in the OEOIS. Just divide the $n^{th}$ term by $n^{th}$ factorial and the answer will be the finite sum. Eg: $$1+\frac1{2}+...+\frac1{8} = \frac{109584}{8!}$$

Hope this helps!

Not an answer to your question but too long for a comment: Wolfram Alpha

when entering the Mathematica one liner:

Clear[n, s];
Table[Limit[Integrate[((s + 1)^(-n - 1) + s - 1)/s, s], s -> 0], {n,
1, 12}]


It is not a closed form since I have been told that one cannot have such an indefinite integral in a closed form. But in the Wolfram Alpha answer we have the latexified expression:

$$H(n)=\lim_{s\to 0} \, \int \frac{(s+1)^{-n-1}+s-1}{s} \, ds$$

The formula for sum of H.P. remained unknown for many years, but now I have found the formula as an infinite polynomial.

The formula or the infinite polynomial which is equal to the sum of th H.P. $\frac{1}{a} + \frac{1}{a+d} + \frac{1}{a+2d} + \frac{1}{a+3d} + ........$ is :-

$Sum of H.P. = (1/a) [1 + \frac{1}{1×(1+b)}(x-1) - \frac{b}{(2×(1+b)(2+b)}(x-1)(x-2) + \frac{b^2}{3×(1+b)(2+b)(3+b)}(x-1)(x-2)(x-3) - \frac{b^3}{4×(1+b)(2+b)(3+b)(4+b)}(x-1)(x-2)(x-3)(x-4) + \frac{b^4}{5×(1+b)(2+b)(3+b)(4+b)(5+b)}(x-1)(x-2)(x-3)(x-4)(x-5) - .....]$

Here, $b=d/a$ and $x$ is the number of terms upto which you want to find the sum of the H.P. Substitute any natural number in place of x and get the sum of the harmonic series.

For more information, visit https://facebook.com/ElementaryResearchesinMathematics.

I have not provided any proof here since that will be a very difficult task at this platform.