TITLE: Riemann integration with countable discontinuities
QUESTION [5 upvotes]: I have a question about 'choosing partition points' for Riemann integrability.
For example,

Let $f:[0,1]\to\mathbb{R}$ be a function defined by $$f(x)\left\{\begin{array}{cl} 0, & x\in E, \\ 1, & \text{otherwise}. \end{array}\right.$$ where $E=\{\frac{1}{n}\,:\,n\in\mathbb{N}\}$.

Indeed, for any given $\varepsilon>0$, choose a number $N\in\mathbb{N}$ so that $1/N<\varepsilon/2$, and a partition $P\in\mathscr{P}[0,1]$ so that $P=\{0=x_{0}<\cdots<x_{n}=1\}$ with $||P||<\frac{\varepsilon}{4N}$. Then, if $n\ge N$, we have
\begin{align*}
U(f,P)-L(f,P)&=\sum_{k=1}^{n}(M_{k}-m_{k})\Delta{x_{k}}\\
&<\sum_{k=1}^{n}1\cdot\Delta{x_{k}}\\
&<\frac{\varepsilon}{4N}\sum_{k=1}^{n}1=\frac{\varepsilon}{4N}\cdot n<\varepsilon.
\end{align*}
where $M_{k}$ and $m_{k}$ is the supremum and infimum on each subinterval of $[0,1]$, respectively.
First of all, I think my proof is not true. But, it seems to be true..
Actually, i consider only the value of $M_{k}-m_{k}$ on each subintervals is at most $1$, so i didn't consider the points of discontinuities of $f$ when taking a partition.
Why this proof is false? Can anyone explain it?
Give some advice/comment. Thank you!

REPLY [2 votes]: Hint: split $\sum (M_k-m_k)\Delta x_k$ into the sum over $k <\epsilon$ and the remaining sum. In the second sum there are only at most $\frac 1 {\epsilon}$ values of $k$ where $M_k-m_k\neq 0$. Make the norm of the partition less than $\epsilon^{2}$.