An approximation related to Euler's constant and the Harmonic number Let's consider Euler's constant $\gamma$, i.e., 
$$\gamma=\lim_{n\to \infty} \sum_{k=1}^n\frac{1}{k}-\ln(n).$$ 

Prove the following approximation: 
  $$\sum_{k=1}^{m-1}\frac{1}{k}-\ln(m)+\frac{1}{2m}+\frac{1}{12m^2}\approx \gamma.$$

The above approximation can be found in many places, e.g. John D. Cook's blog and appears back in Concrete Mathematics asymptotics chapter as a non-trivial exercise of Euler's summation formula. While there are more efficient algorithms that estimates Euler's constant, this approximation allows also one way to look at large values of the Harmonic number (as mentioned in John's blog).
 A: We have
\begin{align}
\sum\limits_{k = 1}^m {\frac{1}{k}}  - \log m  &= \sum\limits_{k = 1}^m {\frac{1}{k}}  - \log \prod\limits_{k = 2}^m {\frac{k}{{k - 1}}} 
\\
  &= \sum\limits_{k = 1}^m {\frac{1}{k}}  - \sum\limits_{k = 2}^m {\log \frac{k}{{k - 1}}}   \\&= 1 + \sum\limits_{k = 2}^m {\left[ {\frac{1}{k} - \log \frac{k}{{k - 1}}} \right]} \\  &= 1 + \sum\limits_{k = 2}^\infty  {\left[ {\frac{1}{k} - \log \frac{k}{{k - 1}}} \right]}  - \sum\limits_{k = m + 1}^\infty  {\left[ {\frac{1}{k} - \log \frac{k}{{k - 1}}} \right]} 
\\
  &= 1 + \sum\limits_{k = 2}^\infty  {\left[ {\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right)} \right]}  - \sum\limits_{k = m + 1}^\infty  {\left[ {\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right)} \right]} .
\end{align}
By Taylor's theorem
$$
\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right) =  - \frac{1}{{2k^2 }} + \mathcal{O}\!\left( {\frac{1}{{k^3 }}} \right),
$$
whence the infinite series is convergent and we can write
$$
\sum\limits_{k = 1}^m {\frac{1}{k}}  - \log m = \gamma  - \sum\limits_{k = m + 1}^\infty  {\left[ {\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right)} \right]} ,
$$
with some constant $\gamma$. By Taylor's formula,
$$
\frac{1}{k} + \log \left( {1 - \frac{1}{k}} \right) =  - \sum\limits_{j = 2}^\infty  {\frac{1}{{jk^j }}} ,
$$
hence
\begin{align}
\sum\limits_{k = 1}^m {\frac{1}{k}}  - \log m - \gamma  = \sum\limits_{k = m + 1}^\infty  {\sum\limits_{j = 2}^\infty  {\frac{1}{{jk^j }}} }   = \sum\limits_{j = 2}^\infty  {\frac{1}{j}\sum\limits_{k = m + 1}^\infty  {\frac{1}{{k^j }}} }  = \sum\limits_{j = 2}^\infty  {\frac{1}{{j!}}\sum\limits_{k = m + 1}^\infty  {\frac{{(j - 1)!}}{{k^j }}} } .
\end{align}
By the Euler integral
$$
\frac{{(j - 1)!}}{{k^j }} = \int_0^{ + \infty } {e^{ - kt} t^{j - 1} dt} ,
$$
whence, using the geometric series and the Taylor series of the exponential function,
\begin{align}
\sum\limits_{k = 1}^m {\frac{1}{k}}  - \log m - \gamma   &= \sum\limits_{j = 2}^\infty  {\frac{1}{{j!}}\sum\limits_{k = m + 1}^\infty  {\int_0^{ + \infty } {e^{ - kt} t^{j - 1} dt} } }  \\& = \sum\limits_{j = 2}^\infty  {\frac{1}{{j!}}\int_0^{ + \infty } {\frac{{e^{ - (m + 1)t} }}{{1 - e^{ - t} }}t^{j - 1} dt} } 
\\   &= \int_0^{ + \infty } {\frac{{e^{ - (m + 1)t} }}{{1 - e^{ - t} }}\frac{1}{t}\sum\limits_{j = 2}^\infty  {\frac{{t^j }}{{j!}}} dt}  \\ &= \int_0^{ + \infty } {\frac{{e^{ - mt} }}{{e^t  - 1}}\frac{{e^t  - t - 1}}{t}dt} \\ & = \int_0^{ + \infty } {e^{ - mt} \left( {1 - \frac{t}{{e^t  - 1}}} \right)\frac{1}{t}dt} .
\end{align}
Now for $0<t<2\pi$,
$$
\left( {1 - \frac{t}{{e^t  - 1}}} \right)\frac{1}{t} = \frac{1}{2} - \sum\limits_{n = 1}^\infty  {\frac{{B_{2n} }}{{(2n)!}}t^{2n - 1} } ,
$$
with $B_n$ being the Bernoulli numbers. Noting that our function tends to zero at infinity and employing Taylor's theorem, we have that
$$
\left| {\left( {1 - \frac{t}{{e^t  - 1}}} \right)\frac{1}{t} - \left( {\frac{1}{2} - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{(2n)!}}t^{2n - 1} } } \right)} \right| \le C_N t^{2N - 1} 
$$
for $t>0$ and each positive $N$ with a suitable positive constant $C_N$. Therefore, using the Euler integral,
\begin{align}
\sum\limits_{k = 1}^m {\frac{1}{k}}  - \log m - \gamma   &= \int_0^{ + \infty } {e^{ - mt} \left( {\frac{1}{2} - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{(2n)!}}t^{2n - 1} } } \right)dt}  + \mathcal{O}(1)\int_0^{ + \infty } {e^{ - mt} t^{2N - 1} dt} 
\\  &= \frac{1}{2}\int_0^{ + \infty } {e^{ - mt} dt}  - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{(2n)!}}\int_0^{ + \infty } {e^{ - mt} t^{2n - 1} dt} } \\ &\quad \, + \mathcal{O}(1)\int_0^{ + \infty } {e^{ - mt} t^{2N - 1} dt} 
\\  &= \frac{1}{{2m}} - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{2n}}\frac{1}{{m^{2n} }}}  + \mathcal{O}\! \left( {\frac{1}{{m^{2N} }}} \right).
\end{align}
Re-arranging and subtracting $1/m$ from both sides gives
$$
\sum\limits_{k = 1}^{m - 1} {\frac{1}{k}}  = \log m + \gamma  - \frac{1}{{2m}} - \sum\limits_{n = 1}^{N - 1} {\frac{{B_{2n} }}{{2n}}\frac{1}{{m^{2n} }}}  + \mathcal{O}\!\left( {\frac{1}{{m^{2N} }}} \right).
$$
Taking $N=2$ yields your approximation.
