Let $E:=\{\frac{1}{n}: n\in \mathbb{N}\}$. Define $f$ on $[0,1]$ by $f(x)=\begin{cases}1 ~~~~~~~~\text{if $x\in E$}\\ 0~~~~~~~~\text{if $x\notin E$ }\end{cases}$.
Show that f is Riemann integrable.
Here is my attempt.
Let $\epsilon >0$, define a partition $P_\epsilon$ of $[0,1]$ where $$P_\epsilon=\{0<x_1<x_2<...<1\}$$ On each subinterval $[x_{i-1},x_i]$ define the following sets: $$A= \{i:[x_{i-1},x_i]\cap E=\emptyset\}$$ $$B= \{i:[x_{i-1},x_i]\cap E\neq \emptyset\}$$ Then $A\cap B=\emptyset $, for $i\in A$, $m_i=M_i=0$ and for $i\in B$, $m_i=0$, $M_i=1$
Thus, \begin{split} U(f,P_\epsilon)-L(f,P_\epsilon)&= \sum_{i\in A} (M_i-m_i)\Delta x_i+\sum_{i\in B} (M_i-m_i)\Delta x_i\\ &=\sum_{i\in B} 1 \times \Delta x_i\\ \end{split} Here is where I have a hard time in estimating the mesh of $P_\epsilon$ to get $U(f,P_\epsilon)-L(f,P_\epsilon)<\epsilon$.
I have seen different approaches to solving this problem but I think this approach seems more understanding. Can someone please review my approach, modify or give me hints.
Hint:
Let $\epsilon>0$ and consider the partition $P$, such that:
$1).\ \epsilon$ is a partition point, so that if $n>1/ϵ, 1/n\in [0,\epsilon].$ Let $N\ge 2$ be the smallest integer for which this happens
and
$2).\ $ there are $x_k\in P$, such that $x_k<1/k<x_{k+1}$ and $x_{k+1}−x_k<\epsilon/2k$ for $k<N$.