Study the continuity of the following function that is called Riemann function I have the following function $$f(x)= \begin{cases} |x|& \text{if $x$ is irrational or } x =0 , \\[6pt] \frac {p}{q+1} & \text{if } x=\frac pq, p\in\mathbb Z,q\in\mathbb N ,\,\, \gcd(p,q)=1.\end{cases}$$
I'd like to determine the set of points of continuity and I really don't know how to approach this.
 A: Throughout, all fractions are assumed to be as in your definition of $f$.
$f$ is discontinuous at all $x < 0$, since it is positive for irrationals and negative for rationals.
Consider $x$ positive and irrational and fix $x > \varepsilon >0$. We want to show that there is a $\delta$ such that if $x-\frac{p}{q} < \delta$, then $x-\frac{p}{q+1} < \varepsilon$. We are only considering $\frac{p}{q} < x$ because it is the worst possible case, when $\frac{p}{q+1}$ gets further from $x$. Now, notice that $\frac{p}{q} - \frac{p}{q+1} = \frac{p}{q(q+1)}$. Since $x$ is irrational, choosing $\delta$ small enough we can ensure that the denominators of the rational numbers inside $(x-\delta,x+\delta)$ get as big as we want, because $x$ has positive distance from all the fractions, in particular from all the fractions with small denominators (for instance, if $x=\pi$, taking $\delta<0.1$ we ensure that all the fractions inside $(\pi-\delta, \pi+\delta)$ have denominator bigger than $4$). But then, for all the fractions $\frac{p}{q} \in (x-\delta, x+\delta)$, we have
$$x-\frac{p}{q+1} = x-\frac{p}{q}+\frac{p}{q}-\frac{p}{q+1}=x-\frac{p}{q}+\frac{p}{q(q+1)}<\delta + x\cdot \frac{1}{q+1},$$
which can be made smaller than $\varepsilon$ taking $\delta$ small enough. A very similar argument applies for $x=0$.
On the other hand, if $x=\frac{p}{q} > 0$, then $f$ is not continuous at $x$. Choose $\varepsilon < \frac{p}{q(q+1)}$. Then for each $\delta$ we can find an irrational number $y>x$ such that $y-x<\delta$, but
$$f(y)-f(x)=y-\frac{p}{q+1} = y-\frac{p}{q}+\frac{p}{q}-\frac{p}{q+1}=y-x+\frac{p}{q(q+1)}>\frac{p}{q(q+1)}>\varepsilon. $$
A: Hints for the case $x_0\not\in\Bbb Q$, $x_0 > 0$.
Taking $x$ "near" $x_0$, we can suppose $x>0$ (why?) and:


*

*If $x\not\in\Bbb Q$, $|f(x) - f(x_0)| = ||x| - |x_0|| = |x - x_0|\dots$

*If $x =p/q\in\Bbb Q$ (irreducible fraction, $p >0$, $q>0$), $|f(x) - f(x_0)| = |p/(q + 1) - x|\le|p/q - x_0| + p/(q^2 + q) = |x - x_0| + p/(q^2 + q)$.


Question: the term $p/(q^2 + q)$ can be very big if $x = p/q$ is near $x_0$?
