I would like to solve the following problem from 'Real Analysis and Foundations' by S. Krantz.
Let $a_n = 1+\frac{1}{2} + \frac{1}{3} + \cdots + \frac{1}{n} - \log{n}$ and $\gamma$ be the Euler-Mascheroni constant. Show that $$\vert a_n - \gamma \vert \le \frac{C}{n}$$ for some universal constant $C>0$.
I have no clue how to solve this problem. From searching various sites it seems that $C=\frac{1}{2}$ but I am not sure with this, too. Thanks in advance.
From here we obtain the bounds
$$\frac{1}{2n+2} \leqslant a_n - \gamma \leqslant \frac{1}{2n}$$
Thus, if $a_n - \gamma \leqslant \frac{C}{n}$ then we must have $\frac{C}{n} \geqslant \frac{1}{2n+2}$ which implies for all $n$,
$$C\geqslant \frac{1}{2 + 2/n},$$
and $C = \frac{1}{2}$ is the smallest constant that works.