Riemann integral of $ f(x) = \begin{cases} \frac{1}{n}, & \text{if $x=\frac{1}{n}, \ \ n=1, 2,3 ,\cdots$ } \\ 0, & \text{other where} \end{cases}$ Let $f:[0, 1]\to\mathbb{R}$ and $  f(x) =
\begin{cases}
\frac{1}{n},  & \text{if $x=\frac{1}{n}, \  \ n=1, 2,3 ,\cdots$ } \\
0, & \text{other where}
\end{cases}$
I want to find $\int_{0}^{1} f\, dx.$ I think the answer is $0$.
Any ideas or insight would be greatly appreciated
 A: For any $\epsilon > 0$, choose $n > \dfrac{2}{\epsilon}$,  define a partition $P_n = \{0,\dfrac{1}{n}, 1-\dfrac{1}{n}, 1\}$, we have: $U(f,P_n)-L(f,P_n)= \dfrac{1}{n}\left(\dfrac{1}{n}-0\right)+0\left(1-\dfrac{1}{n}-\dfrac{1}{n}\right)+1\left(1-\left(1-\dfrac{1}{n}\right)\right)- 0= \dfrac{1}{n}+\dfrac{1}{n^2}< \dfrac{2}{n}< \epsilon$. Thus $f$ is Riemann integrable on $[0,1]\Rightarrow \displaystyle \int_{0}^1 f(x)dx = \displaystyle \lim_{n\to \infty} U(f,P_n) = \displaystyle \lim_{n\to \infty} \left(\dfrac{1}{n}+\dfrac{1}{n^2} \right)= 0$.
A: You have $0 \le f \le \bar{f}$ where
$$ \bar{f}(x) =
\begin{cases}
1,  & \text{if $x=\frac{1}{n}, \  \ n=1, 2,3 ,\cdots$ } \\
0, & \text{else}
\end{cases}$$
The Riemann integral of $\bar{f}$ is equal to $0$, hence $f$ Riemann integral is also equal to $0$.
To prove it consider the step functions
$$ \bar{f_p}(x) =
\begin{cases}
1,  & \text{if $x \in (\frac{1}{n}-\frac{1}{2^p n(n+1)},\frac{1}{n}+\frac{1}{2^p n(n+1)})  \cap [0,1] \  \ n=1, 2,  \dots ,p$ } \\
1,  & \text{if $x \in [0,\frac{1}{p+1})$ } \\
0, & \text{else}
\end{cases}$$
For all $p \ge 1$ you have $$0 \le f \le \bar{f} \le \bar{f_p}$$ and $$\int_0^1 \bar{f_p(x)} \ dx = \frac{1}{p+1} + \frac{1}{2^{p+1}}\sum_{k=1}^p \frac{1}{k(k+1)}$$
As the RHS is converging to $0$ as $p \to \infty$, you are done.
A: For any partition $\;P=\{x_i\}_{i=1}^n\;$ of $\;[0,1]\;$ define $\;K_P:=\{ 1\le i\le n\;:\;\;\exists\,\frac1m\in[x_{i-1},x_i]\}\;$. 
Then for any points $\;c_i\in[x_{i-1},x_i]\;$ , we have$${}$$
$$\sum_{i=1}^n f(c_i)(x_i-x_{i-1})=\begin{cases}\sum\limits_{k\in K_P} (x_k-x_{k-1}),\,&\text{if}\;\;c_k=\frac1m\in[x_{i-1},x_i]\;\text{for some}\;i\\{}\\0,\,\text{otherwise}\end{cases}$$
For the integral to exist the limit of the above sum when $\;n\to\infty\;$ and $\;\text{mesh_P}:=\max_i(x_i-x_{i-1})\to 0\;$ must exists finitely without being dependent on the points $\;c_i\;$ chosen, and since
$$0\le\sum_{k\in K_P}(x_k-x_{k-1})\le|K_P|\text{mesh_P}\longrightarrow0$$
the integral exists and its value is zero.
