sum of harmonic progression? Someone asked me for a formula for the sum of the harmonic progression.
So I did some calculations and gave him an approximate formula:
$$\int_1^n\frac{dx}{x} = \frac{y_1 + y_2}{2} + \frac{y_2 + y_3}{2} + \cdots +\frac{y_{n-1} + y_n}{2}$$
where $y_i$ is $i$th term of the HP
$$\ln(n) = \frac{y_1}{2} + y_2 +y_3 + \cdots +\frac{y_n}{2}$$
so 

$$\sum_{i=1}^n y_i = \ln(n) + \frac{y_1 + y_n}{2}$$

e.g. $1+1/2+\cdots+1/10 = 2.8525 $                 
actual result $= 2.9289$
My question is, how to correct this formula?
 A: A good quick approximation: $\log(n + 0.5) + \gamma$.
A yet more accurate approximation: $\log(n)+\gamma+1/2n + 1/12n^2-1/120n^4+1/252n^6-1/240n^8+1/132n^{10}-691/32760n^{12}+\cdots$, taking as many terms as is convenient.

Error analysis:
The first formula above has maximum error of $1/24n^2$.  uday's first answer has error of about 0.0024 ln n.  Mine is a better approximation for all $n\neq6$.
The first formula is also better than uday's revised formula for all $n\ge46$. The expected error in uday's answer is about 0.000016.
A: The partial sums of the harmonic series are called "harmonic numbers." The difference between the nth harmonic number and ln(n) tends to a limit as n increases, and that limit is called Euler's constant or gamma.
There's a great book about all this called Gamma: Exploring Euler's Constant. 
A: Hey guys.... 
There is no correct simple general formula for sum to n terms of the series 
1+1/2+1/3+1/4+ ............. + 1/n 
but the following formula will be a good approximation for sum to n-terms of the above series when n>5 
S = log(n+0.5) + 0.5772 + 0.04021/(n*n + 0.8848)
Deviation from the actual value fluctuates but remains relatively low.. 
so i guess this may be a good approximation
A: The harmonic progression has a simple and elegant formula, though it's arguably not a closed-form. If $a$ and $b$ are integers:
$$\sum_{j=1}^{n}\frac{1}{a j+b}=-\frac{1}{2b}+\frac{1}{2(a n+b)}-\pi\int_{0}^{1}(1-u)(\cos{2\pi(a n+b)u}-\cos{2\pi b u})\cot{\pi a u}\,du $$
We can generalize this formula, which in the case of odd powers is given by:
\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}}+\\
-\frac{(-1)^{k}(2\pi)^{2k+1}}{2}\int_{0}^{1}\sum_{j=0}^{k}\frac{B_{2j}\left(2-2^{2j}\right)(1-u)^{2k+1-2j}}{(2j)!(2k+1-2j)!}\left(\cos{2\pi(a n+b)u}-\cos{2\pi bu}\right)\cot{\pi au}\,du 
\end{multline}
Since there is more than one way to derive these formulas, another possibility is below ($i$ is the imaginary unit):
\begin{multline} 
\sum_{j=1}^{n}\frac{1}{(a j+b)^{k}}=-\frac{1}{2b^{k}}+\frac{1}{2(a n+b)^{k}}\\+\frac{i(2\pi\,i)^{k}}{2}\int_{0}^{1}\sum_{j=0}^{k}\frac{B_{j}(1-u)^{k-j}}{j!(k-j)!}\left(e^{2\pi i(a n+b)u}-e^{2\pi i\,bu}\right)\cot{\pi a u}\,du 
\end{multline}
The demonstration on how one goes about deriving these formulas was given in this paper.
