# Riemann Integrability of a Piecewise Function

Let $$f(x)= \begin{cases} 0 & \left( x\in \Bbb Q^{\mathrm C} \right)\\ \cfrac{1}{p} & \left( x=\cfrac{q}{p},\; p, q\in \Bbb N,\; \gcd(p, q)=1 \right)\\ \end{cases}$$ Show that $$f$$ is Riemann integrable on $$[0,1]$$.

Since there is always an irrational number in every interval of every partition $$P=\{x_0 ,\; \cdots,\; x_n \}$$, $$L(P,f)=\sum_{i=1}^{n}0 \cdot \Delta x_i =0$$ and $$\sup L(P,f)=0$$.

I assumed that since $$f$$ is Riemann integrable, then $$\inf U(P,f)$$ must be $$0$$ as well. Thus $$U(P,f)=\sum_{i=1}^{n}\cfrac{1}{p_i} \cdot \Delta x_i =0$$ where $$p_i \in \Bbb N$$, since $$p_i \rightarrow \infty$$ as $$n \rightarrow \infty$$.

But I can't seem to prove it. Am I missing something, or is my assumption just wrong?

Edit:

Similar to Is Thomae's function Riemann integrable? except the definition of Riemann integrability I'm using is:

Let $$U(P,f)=\sum_{i=1}^{n}M_i \Delta x_i$$, $$L(P,f)=\sum_{i=1}^{n}m_i \Delta x_i$$ where $$M_i =\sup f(x)$$, $$m_i =\inf f(x)$$ for $$x \in \left[ x_{i-1} , x_i \right]$$. $$f$$ is Riemann integrable if $$\inf U(P,f) = \sup L(P,f)$$.