TITLE: A fractional part integral giving $\frac{F_{n-1}}{F_n}-\frac{(-1)^n}{F_n^2}\ln\left(\!\frac{F_{n+2}-F_n\gamma}{F_{n+1}-F_n\gamma}\right)$
QUESTION [18 upvotes]: I've been asked to elaborate on the following evaluation:

$$
\begin{align}\\
\displaystyle  {\large\int_0^{1}} \!\cfrac 1 {1 + \cfrac 1 {1 + \cfrac 1 {\ddots + \cfrac 1 { 1 + \psi (\left\{1/x\right\}+1)}}}}  
 \:\mathrm{d}x 
& = \dfrac{F_{n-1}}{F_{n}} 
- \dfrac{(-1)^{n}}{F_{n}^2}
\ln \!\left(\!\dfrac{F_{n+2}-F_{n}\gamma}{F_{n+1}-F_{n}\gamma} \right)\\\\
\end{align}
$$ 
  where  $\left\{x\right\}=x-\lfloor x\rfloor$ denotes the fractional part of $x$,  $\gamma$ is the Euler-Mascheroni constant, $F_{n}$ are the Fibonacci numbers, $\psi:=\Gamma'/\Gamma$ is the digamma function and where the continued fraction has a total of $n$ horizontal bars.

REPLY [26 votes]: Here is a general approach.
Recall that the digamma function $\displaystyle \psi : = \Gamma'/\Gamma$ 
admits the following expansion, coming from the Weierstrass infinite product representation of the $\Gamma$ function,
 $$\begin{equation} 
\psi(x+1) = -\gamma + \sum_{k=1}^{\infty} \left( \frac{1}{k} - \frac{1}{x+k}  
\right), \quad x >-1, 
\end{equation}
$$ where $\gamma$ is the Euler-Mascheroni constant. By differentiation, one obtains 
$$\begin{equation}
\psi'(x+1) = \sum_{k=1}^{\infty} \frac{1}{(x+k)^2}, \quad x>-1. 
\end{equation}
$$

Theorem 1. Let $f$ be integrable on $(0,1)$. Then
  $$\begin{equation} 
  \displaystyle \int_{0}^{1}  f \left(\left\{1/x\right\}\right)  \mathrm{d}x =
  \int_{0}^{1}  f(x) \: \psi'(x+1) \mathrm{d}x \tag1
\end{equation}$$ 
  where  $\left\{x\right\}=x-\lfloor x\rfloor$ denotes the fractional part of $x$, $\psi'$ being the derivative of the digamma function 
  $\displaystyle \psi : = \Gamma'/\Gamma$.

Proof. One may write 
\begin{align*}
\displaystyle \int_{0}^{1} f \left(\left\{1/x\right\}\right)  \mathrm{d}x  
&= \sum_{k=1}^{\infty}\int_{\frac{1}{k+1}}^{\frac{1}{k}}  f \left(\left\{1/x\right\}\right)  \mathrm{d}x  \\
&= \sum_{k=1}^{\infty} \int_{k}^{k+1} f\left(\left\{ u \right\}\right) \: \frac{\mathrm{d} u}{u^{2}} \\
&= \sum_{k=1}^{\infty} \int_{k}^{k+1} f\left( u-k \right) \: \frac{\mathrm{d} u}{u^{2}} \\
&= \sum_{k=1}^{\infty} \int_{0}^{1} f\left( v \right) \: \frac{\mathrm{d} v}{(v+k)^{2}}  \\
&= \int_{0}^{1} f\left( v \right)  \sum_{k=1}^{\infty} \frac{1}{(v+k)^{2}} \: \mathrm{d} v \\
&=   \int_{0}^{1}  f(v) \: \psi'(v+1) \: \mathrm{d}v,
\end{align*} 
where the interchange between the infinite sum and the integration is allowed by the 
uniform bound: $$    
\quad \left|\, \sum_{k=1}^{N} \frac{1}{(v+k)^{2}} \, \right| \, < \,
  \frac{\pi^{2}}{6},  \quad N \geq 1, \, 0 \leq v \leq 1.$$
One of the consequences of Theorem 1 is that the transformation 
$ x \rightarrow \gamma+\psi ( \left\{1/x\right\}+1)$ leaves the Lebesgue measure on (0,1) invariant.

Theorem 2. Let $f$ be integrable on $(0,1)$. Then
  $$\begin{align} 
  \displaystyle \int_{0}^{1} 
f \left(\gamma+\psi ( \left\{1/x\right\}+1)\right)\:\mathrm{d}x =
  \int_{0}^{1}  f(x) \: \mathrm{d}x \tag2
\end{align}
$$ where  $\left\{x\right\}=x-\lfloor x\rfloor$ denotes the fractional part of $x$, $\gamma$ being the Euler-Mascheroni constant and $\psi:= \Gamma'/\Gamma.$

Proof.
From $(1)$, one gets
$$
\begin{align*}
\displaystyle \int_{0}^{1} f \left(\gamma+\psi (\left\{1/x\right\}+1)\right) \:\mathrm{d}x  
&= \int_{0}^{1}  f \left(\gamma+\psi (x+1)\right)  \psi' (x+1) \: \mathrm{d}x \\  
& = \int_{0}^{1}  f \left(\gamma+\psi (x+1) \right)  (\gamma+\psi (x+1))' \: \mathrm{d}x  \\
& = \int_{0}^{1}  f(u) \: \mathrm{d}u,
\end{align*}
$$
using the change of variables $u=\gamma+\psi (x+1) $ 
which gives $u(0)=\gamma+\psi(1)=0$ and $u(1)=\gamma+\psi(2)=1$.
Theorem 2 enables one to evaluate a great variety of integrals involving the digamma function in the integrand. 

Proposition 1. Let $n=0,1,2,\cdots .$ Then $$\begin{align} 
\displaystyle \int_{0}^{1} \left(\psi( \left\{1/x\right\}+1)\right)^{n}\:\mathrm{d}x & = \sum_{k=0}^{n}\frac{(-1)^{k}}{n-k+1}{{n}\choose k}\gamma^{k} 
\end{align} \tag3
$$  and 
  $$\begin{align} 
\gamma^{n} = (-1)^{n}\sum_{k=0}^{n}\!{{n}\choose k}B_{k}\!\displaystyle \int_{0}^{1} \! \left(\psi( \left\{1/x\right\}+1)\right)^{n-k}\mathrm{d}x.
\end{align} \tag4
$$ where $\gamma$ is the Euler constant, $\psi:= \Gamma'/\Gamma$ and $B_{k}$ are the Bernoulli numbers.

Proof. Using $(1)$, we may prove $(3)$ by writing $$\begin{align*}
\int_{0}^{1} \left(\psi( \left\{1/x\right\}+1)\right)^{n} \mathrm{d}x  
&= \int_{0}^{1} \left(\gamma+\psi( \left\{1/x\right\}+1)-\gamma\right)^{n}\:\mathrm{d}x  \\
&=\sum_{k=0}^{n} (-1)^{n-k}\gamma^{n-k}{{n}\choose k}
 \int_{0}^{1} \left(\gamma+\psi( \left\{1/x\right\}+1)\right)^{k}\:\mathrm{d}x \\
&= \sum_{k=0}^{n} (-1)^{n-k}\gamma^{n-k}{{n}\choose k} \int_{0}^{1} x^{k}\:\mathrm{d}x \\
& = \sum_{k=0}^{n}\frac{(-1)^{k}}{n-k+1}{{n}\choose k}\gamma^{k}.\end{align*}$$ 
Identity $(4)$ is then deduced from $(3)$ by
appealing to an inversion combinatorial sum (J. Riordan, Inverse Relations and Combinatorial Identities. The American Mathematical
Monthly, Vol. 71, No. 5, May 1964, p. 495).

Proposition 2. $$
\begin{align}\\
\displaystyle  \int_0^{1} \cfrac 1 {1 + \cfrac 1 {1 + \cfrac 1 {\ddots + \cfrac 1 { 1 + \psi (\left\{1/x\right\}+1)}}}}  
 \mathrm{d}x 
& = \dfrac{F_{n-1}}{F_{n}} 
- \dfrac{(-1)^{n}}{F_{n}^2}
\ln \left( \dfrac{F_{n+2}-F_{n}\gamma}{F_{n+1}-F_{n}\gamma} \right) \tag5 \\\\
\end{align}
$$ 
  where  $\left\{x\right\}=x-\lfloor x\rfloor$ denotes the fractional part of $x$,  $\gamma$ is the Euler constant, $F_{n}$ are the Fibonacci numbers, $\psi:=\Gamma'/\Gamma$ is the digamma function and where the continued fraction has $n$ horizontal bars.

Proof. Using $(2)$, we just have to evaluate the corresponding elementary rational function.
One may prove by a simple induction that 
\begin{align} \displaystyle  \cfrac 1 {1 + \cfrac 1 {1 + \cfrac 1 {\ddots + \cfrac 1 { 1 + \, x \,}}}}  
= \dfrac{F_{n}x+F_{n+1}}{F_{n+1}x+F_{n}}  \end{align} where the continued fraction has $n$ horizontal bars, leading easily to $(5)$.