Let $f:[0,1]\to \mathbb{R}$, $f(x)=0$ if $x\not\in \mathbb{Q}$ and $f(x)=\frac{1}{q}$ if $x=\frac{p}{q}$, $p,q$ coprime. $p$ integer, $q$ natural.
I want prove that $f$ is Riemann integrable.
I have a doubt. Let $P=\left\{\frac{1}{n},\frac{2}{n},\ldots, \frac{n-1}{n},1\right\}$ a partition.
Now, $U(f,P)=\frac{1}{n}\sum_{i=1}^n M_i=\frac{1}{n} \sum_{i=1}^n\sup\left\{f(x): x\in [\frac{i-1}{n},\frac{i}{n}]\right\}=\frac{1}{n} \sum_{i=1}^{n} \frac{1}{n}=\frac{1}{n} n\frac{1}{n}=\frac{1}{n}\leq \epsilon$ with $n\to \infty$. Therefore $\inf_{P} U(f,P)=0.$
It is correct?...