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 following 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'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}$.
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)$$
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!
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}$