Solution (source code)

= Solution

Equip $\mathbb N$ with <counting measure> $\#$. For a nonnegative function $f:\mathbb N\to[0,\infty]$, define
$$
\boxed{\sum_{n\geq1}f(n)
:=\int_{\mathbb N}f\,d\#
=\sup_{N\geq1}\sum_{n=1}^Nf(n)}.
$$
This lies in $[0,\infty]$ and agrees with the <series as a Lebesgue integral against counting measure>.

For $f:\mathbb N\to\mathbb C$, define
$$
\sum_{n\geq1}f(n)=\int_{\mathbb N}f\,d\#
$$
when $f$ is integrable, which here means
$$
\boxed{\sum_{n\geq1}|f(n)|<\infty}.
$$
Thus the complex sum is defined under <absolute convergence> and can be obtained by integrating the real and imaginary parts.

A <simple function> on $\mathbb N$ is a function with finite range, equivalently
$$
s=\sum_{j=1}^ma_j\mathbf1_{A_j}
$$
for a finite measurable partition by subsets $A_j\subseteq\mathbb N$. Its nonnegative sum is $\sum_ja_j\#A_j$. It is finite exactly when every level set with $a_j>0$ is finite, equivalently when $s$ has finite support after its zero level is discarded.