Let $f:[0,1]\to\mathbb{R}$ be a function(analogous Thomae's function) defined by $$f(x)=\left\{\begin{array}{cl} \frac{1}{a}, & x\in(0,1)\cap\mathbb{Q},~x=\frac{a}{b}~\text{is irreducible}, \\ 0, & x\in\left\{0,1\right\}\cup((0,1)\cap\mathbb{Q}^c). \end{array} \right.$$
I have a trouble in case of $x=1$.
I tried the following to show the continuity of $f$ at $x=1$:
Let $\varepsilon>0$ be given. Then, there exists $a\in\mathbb{N}$ such that $1/a<\varepsilon$. So, the set $$\left\{a\in\mathbb{N}~|~1/a\ge\varepsilon\right\}$$ is finite. Moreover, the set $$S=\left\{a/b~|~a,b\in\mathbb{N},~\gcd(a,b)=1,~a<b\le2a,~1/a\ge\varepsilon\right\}$$ is also finite. Now, choose $$\delta=\min\left\{|1-s|~:~s\in S\right\}>0.$$ Thus, if $|x-1|<\delta$, then we have $$|f(x)-f(1)|=|f(x)|<\frac{1}{a}<\varepsilon.$$
Is that true? In fact, I'm not sure that the set $S$ is finite.
How to show that the set $S$ is finite?
Or is there another way to show the continuity of $f$ at $x=1$?
Give some advice. Thank you!
Fix $\epsilon>0$ and let $\delta<\frac{1}{2}$. Fix an irreducible rational $\frac{a}{b}$ with $1-\frac{a}{b}<\delta$ and assume $\frac{2}{b}<\epsilon$. Then
$$1-\frac{a}{b}<\delta \Rightarrow \frac{a}{b}>1-\delta >\frac{1}{2}\Rightarrow a>\frac{b}{2}$$ so that $$f(a/b)=\frac{1}{a}<\frac{2}{b}<\epsilon\;.$$ Since there are only finitely many $b\in \mathbb{N}$ such that $\frac{2}{b}>\epsilon$, we can choose $\delta<\frac{1}{2}$ so that $(1,1-\delta)\cap \mathbb{Q}$ contains no rationals $\frac{a}{b}$ with $\frac{2}{b}>\epsilon$.