How to integrate $\int\limits_0^1 \left(-1\right)^{^{\left\lfloor\frac{1}{x}\right\rfloor}} dx$?

Essentially, you have this: $$\int_0^1 \left(-1\right)^{^{\left\lfloor\frac{1}{x}\right\rfloor}} dx=\int_\frac{1}{2}^1\left(-1\right)^1dx+\int_\frac{1}{3}^\frac{1}{2}\left(-1\right)^2dx+\int_\frac{1}{4}^\frac{1}{3}\left(-1\right)^3dx+\int_\frac{1}{5}^\frac{1}{4}\left(-1\right)^4dx+\ldots$$ $$=\left(-1+\frac{1}{2}\right)+\left(\frac{1}{2}-\frac{1}{3}\right)+ \left(-\frac{1}{3}+\frac{1}{4}\right)+\left(\frac{1}{4}-\frac{1}{5}\right)+\ldots$$ $$=-1+2\left(\frac{1}{2}-\frac{1}{3}+\frac{1}{4}-\frac{1}{5}+\ldots\right)$$ $$=-1+2(1-\log2)=1-\log 4$$


One may write \begin{align*} \displaystyle \int_{0}^{1} \left(-1\right)^{\large ^{\left\lfloor\frac{1}{x}\right\rfloor}} \mathrm{d}x &= \sum_{k=1}^{\infty}\int_{\frac{1}{k+1}}^{\frac{1}{k}} \left(-1\right)^{\large ^{\left\lfloor\frac{1}{x}\right\rfloor}} \mathrm{d}x \\ &= \sum_{k=1}^{\infty} \int_{k}^{k+1} \left(-1\right)^{\large ^{\left\lfloor u\right\rfloor}} \: \frac{\mathrm{d} u}{u^{2}} \\ &= \sum_{k=1}^{\infty} \int_{k}^{k+1} \left(-1\right)^{{k}} \: \frac{\mathrm{d} u}{u^{2}} \\ &= \sum_{k=1}^{\infty}\frac{\left(-1\right)^{{k}}}{k (k+1)} \\ &= \sum_{k=1}^{\infty}\frac{\left(-1\right)^k}{k}+\sum_{k=1}^{\infty}\frac{\left(-1\right)^{k+1}}{k+1}\\ &=-\log 2-\log 2+1 \end{align*} where we have used the standard identity $$ \log(1+x)=-\sum_{k=1}^{\infty}\frac{\left(-1\right)^k}{k}x^k, \quad |x|<1, $$ when $x \to 1^-$ (via Abel's theorem).

Finally,

$$\int_{0}^{1} \left(-1\right)^{\large ^{\left\lfloor\frac{1}{x}\right\rfloor}} \mathrm{d}x = 1-2 \log 2. $$