Riemann type function continuity Define real-valued function $f$ on $\mathbb{R}\cap[0,1]$ by setting 
$$f(x)=
\begin{cases}  x,\,\,\text{if $x$ irrational}\\
 p\sin(\frac{1}{q}),\,\, \text{if $x=\frac{p}{q},\gcd(p,q)=1$}\\
\end{cases}
$$
Prove $f$ is continuous at all irrational points of domain. And discontinuous at all rational points.
My try: I want to show when $\frac{p}{q}$ close to $x\in\mathbb{Q}^c$, $q$ will increasing (or inferior increase).
 A: First show that if $\frac{p}{q}\rightarrow x$ then $q\rightarrow \infty$.
$$\frac{p}{q}\rightarrow x \iff  \frac{p}{q}-x\rightarrow 0 \iff 
\frac{p-qx}{q}\rightarrow 0 $$ suppose that $q \rightarrow N \in \mathbb{N}$. Then
$$\frac{p-qx}{q}\rightarrow \frac{p-Nx}{N}$$ and being $p\in \mathbb{N}$ the limit cannot be $0$. Then $q\rightarrow +\infty$.
Now I'll show the continuity for an irrational $x$. It is clear that $f$ considered over the irractional is continuous (it's the identity). If I consider a succession of rationals $\{a_n\}_{n\in \mathbb{N}}=\{\frac{p_n}{q_n} \}_{n\in \mathbb{N}}$ that tends to $x$ then
$$f(a_n)=p_n \sin(1/q_n)=\frac{\sin(\frac{1}{q_n})}{\frac{1}{q_n}}\frac{p_n}{q_n} \rightarrow  x $$ Therefore $f$ is continuous in $x$.
For the discontinuity over the rationals: consider a succession $\{x_n \}_{n\in\mathbb{N}}$ of irrationals approximating $p/q$ (and there is always one for the density of the irrationals in $\mathbb{R}$) then
$$f(a_n)=a_n\rightarrow p/q \neq f(p/q)=p\sin(1/q)$$
in fact $p/q=p\sin(1/q) \iff q \sin(1/q)=0 \iff q=0$ (there is a little error: $f$ is continuous in $0$)
A: After reading Christian Blatter's answer, thanks his method:
Given $\epsilon>0$ and $a\in\mathbb{Q}^c$,define:
$$Q_N:=\{\frac{k}{n}|1\leq n\leq N,1\leq k\leq n\}$$
Then $Q_N$ contains all rationals on $[0,1]$ with denominator $\leq N$. Then we define $\displaystyle \delta_N:=\inf_{x\in Q_N}|x-a|$,it is clear that $\delta_N$ is decreasing with $N$. 
So, there exists $N_1$,such that $\delta_{N_1}<\frac{\epsilon}{2}$, and also there exists $N_2$ such that $\frac{1}{6N_2^2}<\frac{\epsilon}{2}$, then we choose $N=\max\{N_1,N_2\}$.
Now, choose rational $x=\frac{p}{q}$ for which $|x-a|<\delta_N$, by definition of $\delta_N$, we have $x\notin Q_N$,so $q>N$.
Then consider 
$$
\begin{split}
|f(x)-f(a)|&=|p\sin{1 \over q}-a|\\
&\leq |p\sin{1 \over q}-{p\over q}|+|{p\over q}-a|\\
&\leq |{p\over {6q^3}}|+\delta_N\\
& \leq \frac{1}{6N^2}+\delta_N\\
&< \frac{\epsilon}{2}+\frac{\epsilon}{2}=\epsilon
\end{split}
$$
So $f$ is continuous at all irrationals.
As for discontinuity, it is easy to find sequence that not converges to rationals.
