TITLE: Prove that there are an infinite number of discontinuities on this function.
QUESTION [6 upvotes]: Show the  function $f:[0,1]\rightarrow\mathbb{R}$ given by
$$
f(x)=
\begin{cases}
1,&x=\frac{1}{n}\text{ for any positive integer $n$}\\
0,&\text{otherwise}
\end{cases}
$$
has an infinite number of discontinuities.
I have completed the proof, however I'm not sure if it is completely rigorous.
I first showed that there is an infinite number of point that satisfy $$x=\frac{1}{n}$$ in the interval $[0,1]$.
I then defined $k_n$ as follows
$$k_n \in \left(\frac{1}{n+1},\frac{1}{n}\right)\;\forall n\in \mathbb{N}$$ 
I then fixed $n$ and used the following interval for the function $$\left[\frac{1}{n+1},\frac{1}{n}\right)$$
rather than $[0,1]$ since it is a subinterval of $[0,1]$. My logic was that if it is discontinuous on the subinterval then it must be discontinuous on $[0,1]$ but I am not quite sure how to say this rigorously so I simply stated it.
I then negated the definition of continuity and took
$$\epsilon=\frac{1}{2}$$ 
I then substituted
$$f\left(k_n\right) = 0\text{ and }f\left(\frac{1}{n}\right) = 1$$
so, if
$$\left|k_n-\frac{1}{n}\right|<\delta$$
then,
$$\left|0-1\right|=1\geq\frac{1}{2}$$
This was the gist of my proof, I didn't write out everything explicitly for you but, can it be improved? have i missed anything? got a better method? any help is appreciated.

REPLY [2 votes]: Let $x_n = \frac{1}{n}$. Fix $n$ and consider $y_m = \frac{1}{n} + \frac{1}{(n+1)^m}$ with $m \geq 2$. Notice that $y_m = \frac{(n+1)^m + n}{n(n+1)^m}$ is a reduced fraction:
\begin{eqnarray}
\gcd((n+1)^m+n, n(n+1)^m) &=& \gcd((n+1)^m+n,n) \, \gcd((n+1)^m+n,(n+1)^m) \\ &=& \gcd((n+1)^m,n)\,\gcd(n,(n+1)^m) \\&=& 1
\end{eqnarray}
Hence it's not possible to write it as $\frac{1}{k}$ for any $k$. Thus $f(y_m) = 0$ for each $m$ and $f(y_m) \to 0$. On the other hand $y_m \to x_n$ and $f(x_n) = 1$. Hence, $\lim_{m \to \infty} f(y_m) \neq f(\lim_{m \to \infty} y_m)$ and $f$ is not continuous at $x_n$.