I am going through Spivak's Calculus. Thomae's Function is defined (though not named) in the book as:
$$ f(x) = \begin{cases} 0,& x \text { irrational}, \text{ }0<x<1, \\ 1/q , & x = p/q \text{ in lowest terms}, \text{ }0<x<1.\end{cases} $$
For any number $a$ so that $0<a<1$ $f$ approaches $0$ near $a$. The proof starts with letting $n$ be a natural number so large that $1/n <= \epsilon$. Now the only numbers x for which $|f(x) - 0| < \epsilon$ is false $x$ are:
$$ \frac{1}{2},\frac{1}{3},\frac{2}{3},\frac{1}{4},\frac{3}{4},\cdots,\frac{1}{n},\cdots,\frac{n-1}{n}. $$
However, many of these numbers may be, there are only finitely many. Therefore of all these numbers, one is closest to $a$ meaning $|p/q - a|$ is smallest for one $p/q$.(If a is rational, then it might be one of these numbers, in that cases values $p/q$ such that $p/q \ne a$ should be considered.) This closes distance may be chosen as the $\delta$. For if $0<|x-a|<\delta$, then $x$ is not one of:
$$ \frac{1}{2},\cdots,\frac{n-1}{n}. $$
and therefore $|f(x) - 0| < \epsilon$ is true.
Now there are few things I don't seem to understand. I can see why picking an $n$ such that $1/n <= \epsilon$ works but what I don't get is why $1/n < \epsilon$ or $1/n = \epsilon$ wouldn't work instead of $n$ such that $1/n <= \epsilon$. Also what is the reasoning of picking an $n$ such that $1/n <= \epsilon$? Is it because the function returns $\frac{1}{q}$ provided that $x$ is in the form $\frac{p}{q}$? And lastly could this also be considered a proof that shows that there is always an irrational between two reals?