I am interested in Lebesgue integral over $[0;1]$ of the function
$$f(x) = \sum_{n=1}^\infty n \cdot \chi_{[0;n^{-2}]}(x);$$
Here $\chi_{[0;n^{-2}]}(x)$ is $1$ if $x \in [0;n^{-2}]$ and $0$ otherwise.
So intuitively this should be $\zeta(1)$ (summand multiplied by the length of interval, all added together).
However once I wrote $$ A_i = \left[ \frac{1}{(i+1)^2} ; \frac{1}{i^2} \right ); $$
$$ \int_{[0;1]} f(x) d\mu = \sum_{i=1}^\infty \int_{A_i} f(x) d\mu = \sum_{i=1}^\infty \sum_{j=1}^i j \cdot \mu(A_i);$$
From here not everything goes as expected
$$ \int_{[0;1]} f(x) d\mu = \sum_{i=1}^\infty \frac{i(i+1)}{2} \cdot \left( \frac{1}{i^2} - \frac{1}{(i+1)^2} \right) = \frac{1}{2} \sum_{i=1}^\infty \left( \frac{i+1}{i} - \frac{i}{i+1} \right) = \frac{1}{2} \sum_{i=1}^\infty \left( \frac{1}{i} + \frac{1}{i+1} \right) = \zeta(1) - \frac{1}{2};$$
What is the problem?