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?
$$\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.