# Showing that the analytic definition of the Euler Constant is $O(n^{-1})$ [duplicate]

I'm stumped by this one exercise. The question is to "Prove that there exists a positive constant $\gamma$ such that $$\sum_{k=1}^n k^{-1} - \log{n} = \gamma + O(n^{-1})$$ by comparing the sum to a Riemann sum for $\int_1^n x^{-1} dx$."

However, I can't seem to figure out how to show that the approximation is $O(n^{-1})$. By taking the obvious (the left- and right-hand) Riemann sums for the integral, I can get the bound $0 \le \sum_{k=1}^n k^{-1} - \log{n} \le 1$, which is good enough to show that $\gamma = \lim_{n\to \infty} \sum_{k=1}^n k^{-1} - \log{n}$ exists (I think, if I also use the monotonicity of the harmonic numbers and $\log$), but not that the error is $O(n^{-1})$. I think that I need to use the definition of $\gamma$ to get the approximation, but I don't see how I can do any more with the Riemann sum.

-

## marked as duplicate by Eric Naslund, Sivaram Ambikasaran, Mike Spivey, GEdgar, SashaDec 19 '11 at 22:49

Let $[x]$ denote the floor of $x$, and $\{x\}$ the fractional part. Then $$\sum_{k=1}^{n} \frac{1}{k} =1+\int_1^n \frac{[x]}{x^2}dx.$$ Then since $$\int_1^n \frac{[x]}{x^2}dx=\log n -\int_1^n \frac{\{x\}}{x^2}dx,$$ we have $$\sum_{k=1}^{n} \frac{1}{k}= \log n +1-\int_1^n \frac{\{x\}}{x^2}dx.$$
Now, $$\int_1^n \frac{\{x\}}{x^2}dx=\int_1^\infty \frac{\{x\}}{x^2}dx+O\left(\frac{1}{n}\right),$$ so we get the desired result.