Consider the function $f: [0,1] \to \mathbb{R}$ where f(x)= \begin{cases} \frac 1q & \text{if } x\in \mathbb{Q} \text{ and } x=\frac pq \text{ in lowest terms}\\ 0 & \text{otherwise} \end{cases}
Determine whether or not $g$ is in $\mathscr{R}$ on $[0,1]$ and prove your assertion. For this problem you may consider $0= 0/1$ to be in lowest terms.
Here's an attempt. I may have abused a bit of notation here, but the ideas are there.
Proof:
Let $M_i = \sup \limits_{x \in [x_{i-1},x_i]} f(x)$.
Notice first that the lower Riemann sums are always $0$, since every interval contains an irrational number. Thus, to prove $f \in \mathscr{R}$, it suffices to prove that, given any $\epsilon >0$, $\sum \limits_{i \in P} M_i \Delta x_i < \epsilon$ for some partition.
Let $\epsilon > 0 $ and $M > \frac{2}{\epsilon}$. We first show that there exists $\eta(x,\frac{1}{M})$ so that $|f(x) - f(y)| < \frac{1}{M}$ if $|x-y| < \eta$. Fix $x \in (\mathbb{R} \setminus \mathbb{Q}) \cap [0,1]$. Now, consider the set $$R_{M} := \{ r \in \mathbb{Q} : r = \frac{p}{n}, n \leq M, p \leq n, p \in \mathbb{N} \}.$$ Clearly this set is finite, enumerate it as $\{q_1,\ldots, q_m\}$. So, let $$\eta(x,\frac{1}{M}) = \min_{i=1,\ldots, m} |x- q_i|.$$ We see then, $|f(x) - f(y)| < \frac{1}{M}$ on this $\eta$-neighborhood.
After we choose that $\eta$ so that $x \in (\mathbb{R} \setminus \mathbb{Q}) \cap [0,1]$, is continuous in a $\eta$-neighborhood, we see $$ A:= [0,1] \setminus R_M \subset \left( \bigcup_{ x \in ( \mathbb{R} \setminus \mathbb{Q}) \cap [0,1]} B_{\eta(x)} (x) \right) \cap [0,1].$$ Since $A$ is compact, we may take finite sub-covering, and let $\delta = \min \limits_{i=1,\ldots,n} \{\eta(x_i)\}$. Take a partition $P_1$ of $A$ so that $\Delta x_i < \delta$. Since $R_M$ is non-empty, we can take a partition $P_2$ of $R_M$ so that $\Delta x_i < \frac{\epsilon}{2m}.$ Moreover, we see that, on $[0,1]$, $f$ is at most $1$. Let $P = P_1 \cup P_2$. Thus,
\begin{eqnarray*} \sum_{i \in P} M_i \Delta x_i &=& \sum_{i \in P_1} M_i \Delta x_i + \sum_{i \in P_2} M_i \Delta x_i \\ &\leq& \frac{1}{M} \sum_{i \in P_1} \Delta x_i + \sum_{i \in P_2} \Delta x_i \\ &<& \frac{\epsilon}{2} + \frac{\epsilon}{2} = \epsilon \end{eqnarray*}
Comments?
EDITED I think I resolved the issue.
For an alternative approach, choose $N \in \mathbb{N}$ such that $1/(N+1) < \epsilon/2$ and let
$$B_N = \left\{1,\frac{1}{2},\frac{1}{3},\frac{2}{3}, \ldots, \frac{1}{N}, \ldots, \frac{N-1}{N} \right\}.$$
If $x \notin B_N$, then $f(x) \leqslant 1/(N+1) < \epsilon/2$. With $m = \#(B_N)$, choose a partition $P = (x_0,x_1, \ldots, x_n)$ where $n > m$ and $\|P\| < \frac{\epsilon}{4m}.$ There are at most $2m$ subintervals such that $[x_{j-1},x_j] \cap B_n \neq \varnothing.$
Let $M_j = \sup_{x \in [x_{j-1},x_j]} f(x).$
Then, the upper sum satisfies
$$U(P,f) = \sum_{j=1}^n M_j(x_j-x_{j-1}) = \\ \sum_{[x_{j-1},x_j] \cap B_N \neq \varnothing} M_j(x_j-x_{j-1}) + \sum_{[x_{j-1},x_j] \cap B_N = \varnothing} M_j(x_j-x_{j-1}) \\ \leqslant 2m \cdot 1 \cdot \frac{\epsilon}{4m} + \frac{1}{N+1}(1-0) \\ \leqslant \epsilon.$$