# Measurable function f is summable iff |f| is summable

I have learnt the following theorem: Let $$(X,A,\mu)$$ be a measure space and $$f:X \rightarrow \overline{\mathbb{R}}$$ a measurable function. Then $$f$$ is summable if and only if $$|f|$$ is summable. (Note: by summable I mean that the integral exists and is finite).

I want to apply this theorem to the space $$(\mathbb{N}_{>0},2^\mathbb{N}, \#)$$ where $$\#$$ is the counting measure, considering the function $$f:\mathbb{N}_{>0}\rightarrow \overline{\mathbb{R}}$$ is defined by $$f(n)=(-1)^n \frac{1}{n}$$. Then I get that $$f$$ is measurable and the integral equals to the series, but one $$\int |f| d\# = \sum_{n=1}^\infty \frac{1}{n} = \infty$$ whereas $$\int f d\# = \sum_{n=1}^\infty (-1)^n\frac{1}{n} <\infty$$. Where am I wrong? Thank you for your help.

You are mixing up different notions. Convergence of a series $$\sum a_n$$ does not imply that the function $$f(n)=a_n$$ is integrable w.r.t. the counting measure. In your example $$f$$ is not integrable.
Also note that Riemann integrability of $$|f|$$ does not imply Riemann integrability of $$f$$ in contrast with measure theoretic notion of integrability.