# Integral form for the euler-mascheroni gamma constant using floor function

Im trying to prove that: $$\gamma = \lim_{n \to\infty} ( \sum_{1}^n \frac{1}{n} - \log(n)) = 1 - \int_{1}^{\infty} \frac{t- \lfloor t \rfloor}{t^2} dt = 1 - \int_{1}^{\infty} \frac{ \{ t \}}{t^2}dt$$

I need help trying to justify some things, that i dont know if they're right.

First i know the integral exists because its bounded above by the improper integral (using $t -\lfloor t \rfloor < 1$), you get $$\int_{1}^{\infty} \frac{t- \lfloor t \rfloor}{t^2}dt \leq \int_{1}^{\infty} \frac{1}{t^2}dt$$ And that's pretty straighforward

Then working on the integral alone i can rewrite it as $$\sum_{n=1}^{\infty} \int_{n}^{n+1} \frac{t- \lfloor t \rfloor}{t^2} dt =$$ by linearity of the integral and using that $\lfloor t \rfloor = n$ on the interval [$n,n+1$] $$\sum_{n=1}^{\infty} (\int_{n}^{n+1} \frac{t}{t^2} dt - \int_{n}^{n+1} \frac{\lfloor t \rfloor}{t^2} ) = \sum_{n=1}^{\infty} (\log(1+\frac{1}{n}) - \frac{1}{n+1})$$

I know that $\log(1+\frac{1}{n}) < 1$, so $\sum_{n=1}^{\infty} \log(1+\frac{1}{n})$ diverges so "i could" replace it by $\lim_{n \to \infty} \log(n)$ (Here is the part that im not suer how to do) But what would it be the real justification to just, without handwaving it,to divide the infinite sum into two (both series diverge by themselves), then add and substract 1, multiply twice -1 so i get the signs correct in the limit for $\gamma$ replace by the limit of log(n) and put the $1$ into the harmonic series so it starts at $1$ and not $\frac{1}{2}$ thus getting

$$-1 - \lim_{n \to\infty} ( \sum_{1}^n \frac{1}{n} - \log(n))$$

$$\sum_{n=1}^{\infty} (\int_{n}^{n+1} \frac{t}{t^2} dt - \int_{n}^{n+1} \frac{\lfloor t \rfloor}{t^2} )=\lim_{m\to \infty} \sum_{n=1}^{m} (\int_{n}^{n+1} \frac{t}{t^2} dt - \int_{n}^{n+1} \frac{\lfloor t \rfloor}{t^2} )$$
$$=\lim_{m\to \infty}\sum_{n=1}^{m} (\log(1+\frac{1}{n}) - \frac{1}{n+1})=1-\gamma$$