Find a closed form for the following integral: I have to evalute a closed form for the following integral:
$$\int_0^1\left\{\frac{(-1)^{\lfloor\frac{1}{x}\rfloor}}{x}\right\}dx$$
where $\{x\}$ is the fractional part.
I thought of using a substitution $y=1/x$ this will lead me to:
$$\int_\infty^1\frac{\left\{y(-1)^{\lfloor y\rfloor}\right\}}{-y^2}dy$$
And now I have no idea how to proceed.
 A: 
Assignment:
Find a closed form for the following integral:
$$\mathscr{I}:=\int_0^1\left\{\left(-1\right)^{\left\lfloor\frac{1}{x}\right\rfloor}\cdot\frac{1}{x}\right\}\space\text{d}x\tag1$$
Where $\left\lfloor x\right\rfloor$ is the Floor function and $\left\{x\right\}$ is the Fractional part.

Well, let's first consider the substitution $\text{u}:=\frac{1}{x}$, this let's us rewrite $(1)$ as follows:
$$\mathscr{I}=\int_\infty^1-\frac{1}{\text{u}^2}\cdot\left\{\left(-1\right)^{\left\lfloor\text{u}\right\rfloor}\cdot\text{u}\right\}\space\text{du}=\int_1^\infty\frac{1}{\text{u}^2}\cdot\left\{\left(-1\right)^{\left\lfloor\text{u}\right\rfloor}\cdot\text{u}\right\}\space\text{du}\tag2$$
Now, we can break it into the sum of sub-integrals (because if $\text{p}\le\text{s}<\text{p}+1$ we get $\lfloor\text{s}\rfloor=\text{p}$). So:
$$\mathscr{I}=\sum_{\text{k}\ge1}\int_\text{k}^{\text{k}+1}\frac{1}{\text{u}^2}\cdot\left\{\left(-1\right)^{\left\lfloor\text{u}\right\rfloor}\cdot\text{u}\right\}\space\text{du}=\sum_{\text{k}\ge1}\int_\text{k}^{\text{k}+1}\frac{1}{\text{u}^2}\cdot\left\{\left(-1\right)^\text{k}\cdot\text{u}\right\}\space\text{du}\tag3$$
In order to deal with the term $(-1)^\text{k}$ it is not hard to see that we can split the sum further into the following two sums:
$$\mathscr{I}=\sum_{\text{n}\ge1}\int_{2\text{n}-1}^{2\text{n}}\frac{\left\{-\text{u}\right\}}{\text{u}^2}\space\text{du}+\sum_{\text{n}\ge1}\int_{2\text{n}}^{2\text{n}+1}\frac{\left\{\text{u}\right\}}{\text{u}^2}\space\text{du}\tag4$$
We can use the fact that $\left\{-\text{u}\right\}=1-\left\{\text{u}\right\}=1-\left(\text{u}-\lfloor\text{u}\rfloor\right)$:
$$\mathscr{I}=\sum_{\text{n}\ge1}\int_{2\text{n}-1}^{2\text{n}}\frac{1-\left(\text{u}-\lfloor\text{u}\rfloor\right)}{\text{u}^2}\space\text{du}+\sum_{\text{n}\ge1}\int_{2\text{n}}^{2\text{n}+1}\frac{\text{u}-\lfloor\text{u}\rfloor}{\text{u}^2}\space\text{du}\tag5$$
Now, we can use the fact that we are summing over the positive integers. So we can rewrite the floor function terms in the following way:
$$\mathscr{I}=\sum_{\text{n}\ge1}\int_{2\text{n}-1}^{2\text{n}}\frac{1-\left(\text{u}-\left(2\text{n}-1\right)\right)}{\text{u}^2}\space\text{du}+\sum_{\text{n}\ge1}\int_{2\text{n}}^{2\text{n}+1}\frac{\text{u}-2\text{n}}{\text{u}^2}\space\text{du}\tag6$$
You can evaluate the integrals and combining the sums (because they sum over the same interval), in order to get:
$$\mathscr{I}=\sum_{\text{n}\ge1}\left(\frac{1}{2\text{n}-1}-\frac{1}{2\text{n}+1}+\ln\left(\frac{\left(2\text{n}+1\right)\left(2\text{n}-1\right)}{\left(2\text{n}\right)^2}\right)\right)\tag7$$
Split the sum (because they are both absolutely convergent) and use the fact that a sum of $\ln$ functions can be written as a product of the argument:
$$\mathscr{I}=\underbrace{\sum_{\text{n}\ge1}\left(\frac{1}{2\text{n}-1}-\frac{1}{2\text{n}+1}\right)}_{=\space 1}+\ln\left(\underbrace{\prod_{\text{n}\ge1}\frac{\left(2\text{n}+1\right)\left(2\text{n}-1\right)}{\left(2\text{n}\right)^2}}_{=\space\frac{2}{\pi}}\right)=1+\ln\left(\frac{2}{\pi}\right)\tag8$$
Where $\frac{2}{\pi}$ is found using the Wallis product.
