TITLE: A tough integral:$\int_0^{+\infty}\left( \frac1{\log(x+1)-\log x}-x-\frac12\right)^2 dx$
QUESTION [11 upvotes]: I would like to prove the convergence of

$$I=\int_0^{+\infty}\left( \frac1{\log(x+1)-\log x}-x-\frac12\right)^2 dx$$ 

then obtain a closed form of $I$.
Convergence is ensured by the fact that $x \mapsto  f(x)=\left( \frac1{\log(x+1)-\log x}-x-\frac12\right)^2$ is continuous on $(0,+\infty)$ with $f(x) \sim \dfrac14$ as $x \to 0^+$ and $f(x) \sim \dfrac1{144 x^2}$ as $x \to +\infty.$
I did not succeed in finding a closed form of $I$. My attempt was to consider a certain parameter integral then make some differentiation to get rid of the $\log$ terms...

REPLY [8 votes]: Here is an alternate solution: We introduce
$$ I(s) = \int_{0}^{\infty} \left( \frac{1}{e^x - 1} + \frac{1}{2} - \frac{1}{x}\right)^2 \frac{x^s e^x}{(e^x - 1)^2} \, dx. $$
It is easy to check $I = I(0)$ and $I(s)$ is analytic for $\Re(s) > -1$. We can also check that
\begin{align*}
J(n, s)
&:= \int_{0}^{\infty} \frac{x^{s-1}e^x}{(e^x - 1)^{n+1}} \, dx
 = \sum_{k=n}^{\infty} \binom{k}{n} \frac{\Gamma(s)}{k^s} \\
&= \frac{\Gamma(s)}{n!} \sum_{j=0}^{n} (-1)^{n-j} \left[{n \atop j}\right] \zeta(s-j), \tag{1}
\end{align*}
where $\left[{n \atop j}\right]$ denotes the Stirling's number of the first kind. Using this, if $\Re(s)$ is large, then we find that
\begin{align*}
I(s) &= J(3, s+1) + J(2,s+1) + \tfrac{1}{4}J(1, s+1) \\
&\qquad - 2J(2, s) - J(1, s) + J(1, s-1). \tag{2}
\end{align*}
Plugging (1) to this equation and using the principle of analytic continuation, we check that the resulting expression is still valid near $s = 0$. Simplifying (2), we get
$$ I(s) = \left( \frac{\Gamma(s+1)}{6} - \Gamma(s) + \Gamma(s-1) \right)\zeta(s-2) + \frac{1}{12}\Gamma(s+1)\zeta(s) $$
and taking $s \to 0$ we have
$$ I(0) = -2\zeta'(-2) + \frac{1}{12}\zeta(0) = \frac{\zeta(3)}{2\pi^2} - \frac{1}{24}. $$