Darboux Integral of piecewise function I'm having trouble with a proof. 
I'm given $f\colon[0,2] \rightarrow \mathbb{R}$, where $f$ is defined: 
$$f(1/n) = 1 \,\text{if} \ n \in \{1,2,3,...\} $$
and $$ f(x) = 0 \ \text{if} \ x \ \text{not equal to } 1/n $$
The thought is that $f$ is Darboux integrable, and to show as much. The only idea I have is that I know that if a function is continuous on a domain, then we can integrate the function on the domain. Is this the right way? And if so how would I go about doing so? 
 A: First note that $\sup_n\frac1n = 1$ so $f$ is zero on $(1,2]$; hence we need only consider the restriction of $f$ to $[0,1]$. Also, the lower Darboux sum over any partition is clearly equal to zero, as any interval contains an irrational number. It suffices then to show that for any $\varepsilon>0$, there exists a partition $\mathcal P$ of $[0,1]$ such that the upper sum $U_f(\mathcal P)<\varepsilon$. Let Choose a positive integer $N>\frac2\varepsilon$, then $$[0,1] = \left[0,\frac1N\right]\cup\left[\frac1N,1\right].$$  Set $\mathcal P_N=\left\{0,\frac1N,1\right\}$. Since $f$ is nonzero at only finitely many points on $\left[\frac1N,1\right]$, let 
$$
\mathcal P_N = \mathcal P_n \cup \bigcup_{i=1}^{N-1} \left\{\frac{i+2^{-(N+1)}}N , \frac{(i+1)-2^{-(N+1)}}N\right\},
$$
then
\begin{align}
U_f(\mathcal P_N) &\leqslant U_f\left(\mathcal P_N\cap\left[0,\frac1N\right]\right) + U_f\left(\mathcal P_N\cap\left[\frac1N,1\right]\right)\\
&\leqslant \frac\varepsilon2 + \sum_{n=1}^N 2^{-N}\frac1N\\
&\leqslant \frac\varepsilon2 + \frac\varepsilon2\\
< \varepsilon,
\end{align}
since
$$
\sum_{n=1}^N 2^{-N}\leqslant \sum_{n=1}^N 2^{-n} = 1 - 2^{-N}<1.
$$
