# Lebesgue measure and integral

i have a question about Lebesgue measure and integration. We have the follwoing situation:

Let $(q_n)_n$ be a counting of the rational numbers $\mathbb{Q}$. Define $g:\mathbb{R}\rightarrow[0,\infty)$ by $g(x)=x^{-1}$ if $0<x<1$ and $g(x)=0$ otherwise. With this define a new function $f:\mathbb{R}\rightarrow[0,\infty)$ by $f(x)=\sum{2^{-n}g(x-q_n)}$ if the sum is finite and $f(x)=0$ otherwise

Task: Prove that $f$ is Lebesgue-measurable but not integrable over any interval.

I knwo what it means to be Lebesgue integrable and also measurable, but i can not apply this to this situation. Is there somebody who can help me?

Thanks al lot.

This is a partial answer showing that $f$ is measurable:
If $\phi,\gamma$ are measurable functions, $t$ an element of the domain and $\alpha$ a scalar, then so are $\alpha \phi$, $\phi+\gamma$, $x \mapsto \phi(x-t)$ and $x \mapsto \max(\phi(x),\gamma(x))$. If $\phi_n$ are measurable, then so is $\lim_n \phi_n$ (assuming the limit is finite). In addition, the indicator function of a measurable set is measurable.
By considering the sets $g^{-1} (-\infty, \alpha)$ for various values of $\alpha$ (only three ranges of $\alpha$ need be considered), we see that $g$ is measurable (and non-negative), hence the functions $x \mapsto 2^{-n} g(x - q_n)$ are all measurable.
We see that $\phi_n(x) = \sum_{k=1}^n 2^{-k} g(x-q_k)$ is also measurable by the same considerations. Note that $\phi_{n+1}(x) \ge \phi_n(x) \ge 0$ for all $x$, hence the limit $\phi(x)= \lim_n \phi_n(x)$ exists (but may be not be finite for all $x$). Let $\alpha \in \mathbb{R}$, then since $\phi^{-1} (-\infty,\alpha] = \cap_n \phi_n^{-1} (-\infty,\alpha]$, we see that the sets $\phi^{-1} (-\infty,\alpha]$ are measurable. Consequently $\phi^{-1} \mathbb{R}$ and hence $A_\infty = \{ x | \phi(x) = \infty \} = (\phi^{-1} \mathbb{R})^c$ are measurable.
If we let $f(x) = \phi(x) 1_{A_\infty^c}(x)$ (note that this is the same $f$ as in the OP's question), then by considering the sets $f^{-1} (\infty, \alpha]$, we see that $f$ is measurable.