Q:

Closed form for $\int_0^x \{1/t \}\,\mathrm{d}t$, $x \in \mathbb{R}_+$ and related.

After some tests I think that

Conjecture 1 Let $x \in \mathbb{R}_+$ then
  $$
\int_{0}^{x}\left\{\,1 \over t\,\right\}\,{\rm d}t
= 1 - \gamma  + H_{\left\{1/x\right\}} - x\left\lfloor\, 1/x\,\right\rfloor
+ \log\left(\,x\,\right)
$$

Where $\{x\} = x - \left\lfloor\, x\,\right\rfloor$ is the fractional part of a number, and $H_{n} = \sum_{k=1}^{n} 1/n$ is the sum of the $n$ first harmonic numbers. I have confirmed the result above for integral for $x\geq 1$. It reduces to
$$
\int_0^x \left\{1 \over t\right\}\,{\rm d}t
= 1 - \gamma + \log\left(\,x\,\right)\,, \qquad x \geq 1
$$
Does the above result hold for $x \in \left(\,0,1\,\right)$ ? Does the more general integral
$$
\int_{0}^{x}\left\{\,1 \over t\,\right\}^{p}\,{\rm d}t
= 1 - \gamma
$$
Where $x \in \mathbb{R}$ and $p \geq 1$ have a similar closed form?
I know the case with $p \geq 1$ and $x=1$ has been solved. 

A:

Let's focus on the case $x \in (0,1)$, the difficult part.

Conjecture 1 Let $x \in (0,1)$ then $$ \int_0^x \left\{ \frac{1}{t} \right\}\,\mathrm{d}t
      = 1 - \gamma  + H_{\{1/x\}} - x\lfloor1/x\rfloor + \log x$$

(where $\{x\} = x - \lfloor x\rfloor$ is the fractional part of a number, and $H_n = \sum_{k=1}^n 1/k$ are the harmonic numbers.)
Please, your Conjecture 1, as stated above, is not in accordance with the numerical results obtained from WA/Mathematica, when $x=\frac12, \frac13, \frac14, \cdots$. Could you please check it?
For example, you may find that
$$
\int_0^{1/2} \left\{ \frac{1}{t} \right\}\,\mathrm{d}t = \frac32- \gamma- \log 2 = 0.2296371545 ... ,
$$ whereas putting $x=1/2$ in Conjecture 1 doesn't give the same result (it produces a negative number).
We could suggest the following partial conjecture. 

Conjecture. Let $q$ be any integer such that $q \geq 1.$ Then $$ \begin{align} \int_0^{1/q} \left\{ \frac{1}{t} \right\}\,\mathrm{d}t
      &= H_{q}- \gamma- \log q \qquad (*) \quad (proved)
\\
\\
\int_0^{1/q} \left\{ \frac{1}{t} \right\}^2\,\mathrm{d}t
      &= H_{q}- \gamma+\log(2\pi)+2q\log q-2q-2\log(q!) \qquad (**)
\end{align} 
$$

This one matches the numerical approximations.

We have the following result.

Proposition. Let $x$ be a real number such that $x >0$ and let $p=1,2,3, ... .$ Then
  $$
\begin{align}
\int_0^x &\left\{ \frac{1}{t} \right\}^p\mathrm{d}t = (-1)^p \lfloor1/x\rfloor^p \left(x-\frac{1}{\lfloor1/x\rfloor+1} \right) - (-1)^p p\lfloor1/x\rfloor^{p-1} \log \left(x\lfloor1/x\rfloor+x \right) \\
&+ \sum_{k=2}^p \frac{(-1)^{p-k}}{k-1}{p \choose k} \lfloor1/x\rfloor^{p-k}\left( (\lfloor1/x\rfloor+1)^{k-1}-\frac{1}{x^{k-1}}\right)  + \int_0^{{\small \displaystyle \frac{1}{\lfloor1/x\rfloor+1}}} \left\{ \frac{1}{t} \right\}^p\mathrm{d}t
\end{align}
$$

Proof. We start as aziiri did.
$$\begin{align}
\int_0^x \left\{\frac{1}{t} \right\}^p \mathrm{d}t & = \int_{1/x}^{\infty} \frac{\{u\}^p}{u^2} \mathrm{d}u \\
& = \int_{1/x}^{\lfloor1/x\rfloor+1} \frac{\{u\}^p}{u^2} \mathrm{d}u +\int_{\lfloor1/x\rfloor+1}^{\infty} \frac{\{u\}^p}{u^2} \mathrm{d}u \\
& = \int_{1/x}^{\lfloor1/x\rfloor+1} \frac{(u-\lfloor1/x\rfloor)^p}{u^2} \mathrm{d}u +\int_0^{{\small \displaystyle \frac{1}{\lfloor1/x\rfloor+1}}} \left\{ \frac{1}{t} \right\}^p\mathrm{d}t
\end{align}$$ 
then we apply the binomial expansion to explicit the first integral on the last line.

Clearly the problem amounts to find a general closed form for the integrals
  $$
\int_0^{1/q} \left\{ \frac{1}{t} \right\}^p\mathrm{d}t
$$
  for $p=1,2,3, ... $ and $q=1,2,3, ...$.

A:

First thing set $y=1/t$ and $n=\lfloor 1/x\rfloor$ (for simplicity), then  $$\begin{aligned}f(x)= \int_0^x \left\{ \frac{1}{t} \right\}\,\mathrm{d}t &= \int_{1/x}^{\infty} \frac{\{y\}}{y^2} \ \mathrm{d}y = \left(\sum_{k=n+1}^{\infty} \int_k^{k+1} \frac{x-k}{x^2} \ \mathrm{d}y\right) +\int_{1/x}^{n+1} \frac{y-n}{y^2} 
\end{aligned}$$ Integrate simply to get : $$\begin{aligned} f(x)&=n \left(\frac{1}{n+1}-x\right)+\log (n+1)+\log (x)+ \sum_{k=n+1}^{\infty} \ln (k+1) -\log k - \frac{1}{k+1} \\ &=n \left(\frac{1}{n+1}-x\right)+\log (n+1)+\log (x)+H_{n+1}-\log (n+1) -\gamma \\   &=n \left(\frac{1}{n+1}-x\right)+\log (x)+H_{n+1}-\gamma \end{aligned}$$ 
Now, feel free to substitute $n=\lfloor 1/x\rfloor$ and maybe simplify the expression using some integer part identities.

