Integrability of Riemann function I need to show directly integrability of Riemann function (which is zero in $\mathbb R\setminus\mathbb Q$ and equals $\frac {1} {n} $ for $x \in \mathbb Q$ such that $ x = \frac {m} {n}, m,n \in \mathbb Z$ irreducible fraction) without using Lebesgue's criterion and evaluate integral.
As I understand, the problem reduces to statement like for quite small neighborhood of any $x \in \mathbb R$ there is no such $\frac {m} {n}$ that $n<N$ for any $N$, It would mean that partition (of some segment $[a,b]$ ) could be made so small that $\sup\left| f(x_1) - f(x_2)\right| < \epsilon$ for $x_1, x_2$ are inside of element of our partition. The question is how to show this statement or is there some another way?
 A: Here's a direct proof. The basic idea behind it is that we wanna get a lower bound on the upper sum. We do this by seeing that if we choose some number, say $\eta > 0$, then there are only finitely many points on $[0, 1]$ for which $f(x) > \eta$. So though $f$ is positive at every rational, it'll only be so large around a handful of points (and even then will be no bigger than $1$), so we can just make sure that they don't contribute too much to the sum by making sure they only sit on small intervals, which can be taken care of by making the partition very fine.
For a partition $P = (p_{1}, \ldots, p_{n - 1})$, where $0 = p_{0} < p_{1} < \cdots < p_{n - 1} < p_{n} = 1$, let
\begin{align*}
\mathcal{L}(f, P) & = \sum_{k = 1}^{n} (p_{k} - p_{k - 1}) \inf_{p_{k - 1} \leq x \leq p_{k}} f(x), \\
\mathcal{U}(f, P) & = \sum_{k = 1}^{n} (p_{k} - p_{k - 1}) \sup_{p_{k - 1} \leq x \leq p_{k}} f(x) .
\end{align*}
Let $f$ denote the Riemann function. Obviously any interval will contain an irrational number, so $\mathcal{L}(f, P) \equiv 0$. We wanna show that if $h(P) = \min_{1 \leq k \leq n} (p_{k} - p_{k - 1})$ denotes the gauge of $P$, then $\lim_{h(P) \to 0} \mathcal{U}(f, P) = 0$.
To do this, fix $\epsilon > 0$. We want to construct a $\delta > 0$ such that if $h(P) < \delta$, then $\mathcal{U}(f, P) < \epsilon$. Fix $\epsilon > 0$.
Let $\phi :[0, 1] \cap \mathbb{Q} \to \mathbb{N}$ denote the simplified denominator, that if $\phi(0) = 1, \phi(2 / 7) = 7, \phi(97 / 194) = 2$, etc. Then given a partition $P$, we can "break it up" into two subsets: those intervals which contain an element such that $\phi(x) \leq N$, and those which don't. So we can write
\begin{align*}
\mathcal{U}(f, P) & = \sum_{k = 1}^{n} (p_{k} - p_{k - 1}) \sup_{p_{k - 1} \leq x \leq p_{k}} f(x) \\
& = \left[ \sum_{ (\exists x \in [p_{k - 1}, p_{k}])(\phi(x) \leq N) } (p_{k} - p_{k - 1}) \sup_{p_{k - 1} \leq x \leq p_{k}} f(x) \right] + \left[ \sum_{ (\not \exists x \in [p_{k - 1}, p_{k}])(\phi(x) \leq N) } (p_{k} - p_{k - 1}) \sup_{p_{k - 1} \leq x \leq p_{k}} f(x) \right] \\
& \leq \left[ \sum_{ (\exists x \in [p_{k - 1}, p_{k}])(\phi(x) \leq N) } (p_{k} - p_{k - 1}) \right] + \left[ \sum_{ (\not \exists x \in [p_{k - 1}, p_{k}])(\phi(x) \leq N) } (p_{k} - p_{k - 1}) \frac{1}{N + 1} \right] \\
& \leq \left[ \sum_{ (\exists x \in [p_{k - 1}, p_{k}])(\phi(x) \leq N) } (p_{k} - p_{k - 1}) \right] + \frac{1}{N + 1} .
\end{align*}
But note further that for any given $N \in \mathbb{N}$, the set $S_{N} = \{ x \in [0, 1] : \phi(x) \leq N \}$, though perhaps very large, is finite. So set
$$\delta_{1} (N) = \frac{1}{3} \min \{ |x - y| : x, y \in S_{N} , x \neq y \} .$$
Notice that if $h(P) < \delta_{1} (N)$, then exactly one interval contains each element of $S_{N}$, i.e. there are exactly $\# S_{N}$ many intervals that contain elements of $S_{N}$.
Note that up to now, all we've been discussing has been with respect to some $N$. Now we'll nail down exactly what we want out of our $N$. Set $N \in \mathbb{N}$ sufficiently large that $\frac{1}{N + 1} < \epsilon / 2$. This $N$ will serve as the anchor for the rest of our calculations.
Now let $\delta_{2} (N) > 0$ be such that $( \# S_{N} ) \cdot \delta_{2}(N) < \epsilon / 2$, and set $\delta = \min \{ \delta_{1}(N), \delta_{2}(N) \}$. Then if $h(P) < \delta$, we have
\begin{align*}
\mathcal{U}(f, P) & \leq \left[ \sum_{ (\exists x \in [p_{k - 1}, p_{k}])(\phi(x) \leq N) } (p_{k} - p_{k - 1}) \right] + \frac{1}{N + 1} \\
& < \left[ \sum_{ (\exists x \in [p_{k - 1}, p_{k}])(\phi(x) \leq N) } (p_{k} - p_{k - 1}) \right] + \epsilon / 2 \\
& \leq (\# S_{N})h(P) + \epsilon / 2 \\
& \leq (\# S_{N}) \delta_{2}(N) + \epsilon / 2 \\
& = \epsilon / 2 + \epsilon / 2 \\
& = \epsilon .
\end{align*}
