While studying the GRE Math Subject test, I came across a property in a proof that for the function
$$f(x)=
\begin{cases}
0, & x \notin \mathbb{Q} \cap(0,1)\\
\frac{1}{n}, & x=\frac{m}{n}
\end{cases}
$$
with $GCD(m,n)=1, n>0$, that $f$ is continuous on every irrational point in $I=(0,1)$, and discontinuous on the rationals there.
The property in question is the following:
Given a positive integer, $q$, and an irrational number $a$ in any open sub-interval of $I$ centred at $a$, there are fewer than $1+2+ \cdots + (q-1) = \frac{q(q-1)}{2}$ rationals of the form $\frac{m}{n}<1$ with $n<q$.
Can someone help me make sense as to why this might be true?