Why is $1 + \frac{1}{2} + \frac{1}{3} + ... + \frac{1}{n} \approx \ln(n) + \gamma$? On StackExchange, I read that the harmonic series up to $\frac{1}{n}$ is approximately $\ln(n) + \gamma$, where $\gamma$ is the Euler-Mascheroni constant, which is close to $0.5772$. When I researched the Euler-Mascheroni constant, I only found it defined in terms of the difference between the harmonic series and $\ln(n)$.
Why is the series able to be approximated in this way, and what is the Euler-Mascheroni constant?
 A: $$\log n = \int_1^n \frac{dx}{x} = \sum_{i=1}^{n-1}\int_{i}^{i+1}\frac{dx}{x}$$
So:
$$\left(\sum_{i=1}^n \frac 1 i\right)-\log n = \left(\sum_{i=1}^{n-1}\int_i^{i+1}\left(\frac 1i-\frac1x\right)dx\right) + \frac{1}{n}$$
Now, for $x\in[i,i+1]$, $0\leq\frac{1}i-\frac1 x\leq \frac{1}{i(i+1)}.$
So these terms are positive and $\sum_{i=1}^\infty \frac{1}{i(i+1)} = 1$. So as $n\to\infty$, this means:
$$\left(\sum_{i=1}^n \frac 1 i\right)-\log n$$
converges to a value less than $1$.
It's actually pretty easy to show, since $f(x)=1/x$ is concave, that:
$$\int_i^{i+1}\left(\frac 1i-\frac1x\right)dx>\frac{1}{2i(i+1)}$$
This means that the limit is between $1/2$ and $1$.
This is often the definition of the Euler-Mascheroni constant.
A: As noted in the comments, the "computational" answer is that, comparing areas, we find
$$\int_1^{n+1}\frac{dx}{x}<1+{1\over 2}+\cdots +{1\over n}<1+\int_1^n\frac{dx}{x}$$ Evaluating the integrals gives $$\ln(n+1)<1+{1\over 2}+\cdots +{1\over n}<1+\ln n$$ so we have the very rough approximation that, denoting $$H_n=1+{1\over 2}+\cdots +{1\over n}$$ the sum is around $H_n\approx \ln n$.

A more insightful perspective is to compare the nature of the functions $H_n$ (often called the "harmonic sum") and $\ln x$. The former is discrete, and the latter continuous. In "discrete calculus" you often see $$\Delta f(n)=f(n+1)-f(n)$$ which is the discrete analogue of the derivative. Note that the "derivative" of the harmonic sum is $$\Delta H_n=H_{n+1}-H_n=\left(1+\cdots +{1\over n+1}\right)-\left(1+\cdots +{1\over n}\right)={1\over n+1}$$
Similarly, the derivative of the logarithm is $$\textrm{D}\ln x={1\over x}$$
(The analogy can be drawn further, depending on how much discrete maths you know) There is a sense then, in which the two functions are "companions" of each other - they live in different universes, but within those universes they share many of the same properties. This is a recurring theme in much of mathematics (you may be interested in researching the word "isomorphic", although it does not completely apply here).
