Prove integrability of $f$ where $f(x)\in\{0,\frac{1}{n}\}$ 
Let $\{a_n\}$ be a sequence of distinct points in $[0,1]$ and let
  $f:[0,1]\to\mathbb R$ be given by $f(x)=\frac{1}{n}$ provided $x=a_n$ and
  $f(x)=0$ otherwise. Using only definitions, prove that $$\int_0^1 f(x)dx$$ exists in the sense
  of Riemann and Darboux.

Darboux. The lower sum $L(f,P)$ is zero for any partition $P$ because any interval of partition contains points other than $a_n$ (since $(a_n)$
 is countable whereas intervals are uncountable). It suffices to show that $U(f,P) < \epsilon$ for any $\epsilon > 0$ and some partition $P$. Obviously $U(f,P)$ is bounded by $1$:  $U(f,P)=\sum_{i=1}^nM_i\Delta x_i\le \sum_{i=1}^n1\cdot \Delta x_i=1$, but I'm not sure how it can be done $< \epsilon$.
Riemann. We need to show that the limit $\lim_{n\to \infty} \sum_{i=1}^nf(\xi_i)\Delta x_i$ exists. Here I have a doubt: can the sample points $\xi_i$ be chosen as we wish? If so, then we could choose points other than $a_n$, and then $f(\xi_i)$ will be zero, and the limit will be zero. But I have the feeling that this doesn't work.
 A: It's obvious that $$\underline{\int_0^1} f(x) \,\text{d}x \geq0.$$
Since for any $2$ functions, $g$ and $h$, that have the property that the set $\{x: g(x)\neq f(x) \}$ is finite, their upper integrals are equal (same for lower integrals), we know that for any $n\in\mathbb{N}$,
$$\overline{\int_0^1} f(x)\,\text{d}x = \overline{\int_0^1} \min\{f(x), \frac{1}{n}\}\,\text{d}x \leq\frac{1}{n}. $$
Since $n$ is arbitrary,
$$\overline{\int_0^1} f(x)\,\text{d}x \leq0. $$
From definition of Darboux integral:
$$ \int_0^1 f(x)\,\text{d}x =0.$$
Of course it means the integral exists.
A: Consider $\varepsilon >0$ and suppose $a_1 \neq 0$. Consider $I_1=(a_1-\varepsilon_1, a_1+\varepsilon_1)$, where $\varepsilon_1 \leq \frac{\varepsilon}{4}$ is small enough to guarantee $I_1 \subset  [0,1]$.
Let $n_2$ the small index such that $a_{n_2} \notin I_1$. Consider $I_2=(a_{n_2}-\varepsilon_2, a_{n_2}+\varepsilon_2)$, where $\varepsilon_2 \leq \frac{\varepsilon}{8}$ is small enough to guarantee that $I_1 \cap I_2 =\emptyset$. 
Repeating these process, we can cover the points where $f$ is descontinuous by intervals $I_j$ such that $$\sum |I_j| \leq \sum \frac{\varepsilon}{2^n} \leq \varepsilon.$$ 
Conclusion: the set of point where $f$ is descontiuous has null measure. In consequence, $f$ is Riemann integrable.
If $a_n=0$ or $a_n=1$ for any $n$, restrict the corresponding interval $I_j$ to half of it.
