We define $$\rho(x):=\sum_{n=1}^\infty 1_{\text{squarefree}}(n)\cdot\frac{\sin\left(n^2\pi x\right)}{n^2},\tag{1}$$
where the first factor inside the previous series is the characteristic function
$$1_{\text{squarefree}}(n) = \begin{cases} 1 & \text {for }n=1 \\ 1 & \text{if } \operatorname{rad}(n) = n \\ 0 & \text{if }\operatorname{rad}(n) < n \\ \end{cases},$$
with $\operatorname{rad}(n)$ denoting the radical of an integer, see this Wikipedia. Thus $1_{\text{squarefree}}(n)$ is the indicator function of squarefree numbers. See the definiton of this set for example from this MathWorld that also provide us the code SquareFreeQ[n] that I've used in my toy example:
plot sum (Boole(SquareFreeQ(n)) Sin(n^2 pi x))/n^2, from n=1 to 100, for 0<x<5
with the pupose to plot in Wolfram Alpha online calculator.
Definition $(1)$ is similar than Weierstrass function, see the MathWolrd's entry for Monsters of Real Analysis.
Question. Can you calculate the are under the curve (the graph of) $\rho(x)$ defined in $(1)$ over the interval $[0,\frac{1}{2}]$? If isn't possible explain what handicaps do you find when you've tried to apply your numerical methods and/or definition of integral to get it. Many thanks.
The series is uniformly convergent on $\bigl[0,{1\over2}\bigr]$, hence can be integrated termwise. One obtains $$\int_0^{1/2}{\sin(n^2\pi x)\over n^2}\>dx=0\quad(n\ {\rm\ even}),\qquad{\rm resp.,}\quad ={1\over\pi n^4}\quad(n\ {\rm\ odd})\ .$$ Now this was not terribly difficult. But anyway, we didn't have to look at the graph of the function at stake.