Evaluating a strange integral... I was given this integral by a friend and have been unable to evaluate it. He said it is easily possible to do it by hand (no calculator or computational aids necessary) 
$$\int_{0}^{1} \mathrm{frac}\left(\frac{1}{x}\right)\cdot\mathrm{frac}\left(\frac{1}{1-x}\right)dx $$
frac is a function that returns the fractional part of x. I attempted to "simplify" this to x-floor(x), but was still unable to get anywhere.
He also gave me a hint that it involves the euler mascheroni constant. I looked at the integral representation of it but was unable to make any progress

Making the variable change, $u = 1-x,$ we have
$$\int_{1/2}^1 \left\{\frac{1}{x} \right\}\left\{\frac{1}{1-x} \right\}  \, dx  = \int_{0}^{1/2} \left\{\frac{1}{1-u} \right\}\left\{\frac{1}{u} \right\}  \, du.  $$
Hence,
$$\int_0^1 \left\{\frac{1}{x} \right\}\left\{\frac{1}{1-x} \right\}  \, dx = 2\int_0^{1/2} \left\{\frac{1}{x} \right\}\left\{\frac{1}{1-x} \right\}  \, dx \\ = 2\lim_{n \to \infty} \sum_{k =2}^n \int_{1/(k+1)}^{1/k} \left\{\frac{1}{x} \right\}\left\{\frac{1}{1-x} \right\}  \, dx. $$
For $1/(k+1) < x < 1/k$ we have $k < 1/x < k+1$ and $1 + 1/k < 1/(1-x) < 1 + 1/(k-1)$.
Hence, for $k \geqslant 2$,
$$\left\{\frac{1}{x} \right\} = \frac{1}{x} - k, \\ \left\{\frac{1}{1-x} \right\} = \frac{1}{1-x} - 1,$$
and
$$\int_0^1 \left\{\frac{1}{x} \right\}\left\{\frac{1}{1-x} \right\}  \, dx = 2\lim_{n \to \infty} \sum_{k =2}^n \int_{1/(k+1)}^{1/k} \left(\frac{1}{x}-k \right) \left(\frac{1}{1-x} -1\right)  \, dx.$$
Proceeding,
$$\begin{align}\int_{1/(k+1)}^{1/k} \left(\frac{1}{x}-k \right) \left(\frac{1}{1-x} -1\right)  \, dx &= \int_{1/(k+1)}^{1/k} \left(\frac{1-kx}{1-x} \right) \, dx \\ &=\int_{1/(k+1)}^{1/k} \left(\frac{(1-k) + k(1-x)}{1-x} \right) \, dx \\ &= [(k-1) \log(1-x) +kx]_{1/(k+1)}^{1/k}  \\ &= (k-1) \log \frac{k-1}{k} - (k-1)\log \frac{k}{k+1} +\frac{1}{k+1} \\ &= k\log \frac{k+1}{k} - (k-1) \log \frac{k}{k-1} - [\log(k+1) - \log k] + \frac{1}{k+1}\end{align}$$
Summing, we get
$$\begin{align}\sum_{k =2}^n \int_{1/(k+1)}^{1/k} \left(\frac{1}{x}-k \right) \left(\frac{1}{1-x} -1\right)  \, dx  &= \sum_{k=2}^n \frac{1}{k+1} -\log(n+1) + n \log \frac{n+1}{n} \\ &= -\frac{3}{2} + \sum_{k=1}^{n+1} \frac{1}{k} - \log(n+1) + \log \left[\left( 1 + \frac{1}{n} \right)^n \right]\end{align}.$$
Taking the limit as $n \to \infty$ we find
$$\lim_{n \to \infty}\sum_{k =2}^n \int_{1/(k+1)}^{1/k} \left(\frac{1}{x}-k \right) \left(\frac{1}{1-x} -1\right)  \, dx = -\frac{1}{2} + \gamma ,$$
and
$$\int_0^1 \left\{\frac{1}{x} \right\}\left\{\frac{1}{1-x} \right\}  \, dx = -1 + 2\gamma.$$
