# Proof of continuity of Thomae Function at irrationals.

I can prove the discontinuity at rational $b$ by taking a sequence of irrationals $x_n$ which converge to $b$.

But while going through an argument for continuity at irrationals.
I found this in a book.

On the other hand if $b$ is an irrational number and $\epsilon > 0$
then there is a natural number $n_0$ such that $1/n_0 < \epsilon$.
There are only finite number of rationals with denominator less than
$n_0$ in the interval $(b-1,b+1)$.
Hence we can find a $\delta > 0$
such that $\delta$ neighbourhood of $b$ contains no rational with
denominator less than $n_0$.

I understand the rest of the proof. But I am unable to prove the emphasized text. Although I find it intuitive.

Let $m=n_0-1$, so we want to consider rationals with denominators $1,\cdots,m$ in the interval $(b-1,b+1)$. Since consecutive rationals with denominator k differ by $1/k$ and the interval $(b-1,b+1)$ has length 2, there are at most 2k rationals with denominator k in $(b-1,b+1)$.
Therefore there are at most $2\cdot1+2\cdot2+\cdots+2m$ rationals in $(b-1,b+1)$ with denominator less than $n_0$, so we can choose a $\delta$ with $0<\delta<|b-r|$, where r is the rational with denominator less than $n_0$ in $(b-1,b+1)$ which is closest to b.