<s>[INST] How to find the sum of the series $1+\frac{1}{2}+ \frac{1}{3}+\frac{1}{4}+\dots+\frac{1}{n}$? How to find the sum of the following series?
$$1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \dots + \frac{1}{n}$$
This is a harmonic progression. So, is the following formula correct?
$\frac{(number ~of ~terms)^2}{sum~ of~ all ~the~ denominators}$
$\Rightarrow $ if $\frac{1}{A} + \frac{1}{B} +\frac{1}{C}$ are in H.P.
Therefore the sum of the series can be written as :
$\Rightarrow \frac{(3)^3}{(A+B+C)}$
Is this correct? Please suggest.
 [/INST] There is a new formula, that I've created. It can be written in a few different ways, below are two of them:
$\sum_{k=1}^{n}\frac{1}{k}=\frac{1}{2n}+\pi\int_{0}^{1} (1-u)\cot{\pi u}\left(1-\cos{2\pi n u}\right)\,du$
$\sum_{k=1}^{n}\frac{1}{k}=\frac{1}{2n}+\frac{\pi}{2}\int_{0}^{1} (1-u)\cot{\frac{\pi u}{2}}\left(1-\cos{\pi n u}\right)\,du$
There is also a generalization that goes beyond the harmonic numbers. 
For a harmonic progression where $a$ and $b$ are integers:
$\sum _{k=1}^n \frac{1}{a k+b}=-\frac{1}{2b}+\frac{1}{2(a n+b)}+2\pi\int_0^1 (1-u)\sin[\pi a n u]\sin[(a n+2b)\pi u]\cot[\pi a u]\,du$
(Notice the formula at the top is a particular case where $a=1$, $b=0$.) For odd powers, the general formula is:
\begin{multline}
\sum_{j=1}^{n}\frac{1}{(a j+b)^{2k+1}}=-\frac{1}{2b^{2k+1}}+\frac{1}{2(a n+b)^{2k+1}}+(-1)^{k}(2\pi)^{2k+1}\\ \int_{0}^{1}\sum_{j=0}^{k}\frac{B_{2k-2j}\left(2-2^{2k-2j}\right)}{(2k-2j)!(2j+1)!}(1-u)^{2j+1}\sin{[\pi a nu]}\sin{[(a n+2b)\pi u]}\cot{[\pi au]}\,du 
\end{multline}
And for a harmonic progression where $a$ and $b$ are complex:
\begin{multline}\nonumber
\sum_{j=1}^{n}\frac{1}{(ai j+b)^k} =-\frac{1}{2b^k}+\frac{1}{2(ai n+b)^k}+ e^{-2\pi b/a}\left(\frac{2\pi}{a}\right)^k\\ \int_{0}^{1}\sum_{j=1}^{k}\frac{\phi\left(e^{-2\pi b/a},-j+1,0\right)(1-u)^{k-j}}{(j-1)!(k-j)!}e^{2\pi bu/a}\left(\frac{\sin{2\pi n u}}{2}+i \frac{1-\cos{2\pi n u}}{2}\right)\cot{\pi u}\,du 
\end{multline}
The proofs are on papers that I've posted to the arXiv.
</s>