<s>[INST] How to calculate the integral of $\operatorname{sgn}(\sin\pi/x)$ in the interval $(0,1)$? How can I calculate the integral of $\operatorname{sgn}(\sin\pi/x)$  in the interval $(0,1)$?
I need to calculate this integral, thanks
 [/INST] Outline: In the interval $(1/2,1)$ our function is $-1$. 
In the interval $(1/3,1/2)$, our function is $1$.
In the interval $(1/4,1/3)$, our function is $-1$.
In the interval $(1/5,1/4)$, our function is $1$. 
And so on. The intervals have length $\frac{1}{1\cdot 2}$, $\frac{1}{2\cdot 3}$, $\frac{1}{3\cdot 4}$, and so on.
So the integral ought to be 
$$-\frac{1}{1\cdot2}+\frac{1}{2\cdot 3}-\frac{1}{3\cdot 4}+\frac{1}{4\cdot 5}-\frac{1}{5\cdot 6}+\cdots.$$
If we want a closed form, note that 
$$\ln(1+x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+\frac{x^5}{5}-\frac{x^6}{6}+\cdots.\tag{1}$$
Now calculate $\int_0^{1} \ln(1+x)\,dx$. This is the same as what we obtain when we integrate the series (1) term by term.   
</s>