Prove $\lim f_n(x) = f(x)$, where $f(x)=0 $ for $x$ irrational and $f(x)=1/q$ if $x =p/q$ is irreducible. 
Let $r_1,\ldots ,r_n, \ldots$ a enumeration of rational numbers such that $r_n=p_n/q_n$ is given in irreducible form. For each $n\in \mathbb{N}$, consider a continuous function $f_n:\mathbb{R}\rightarrow \mathbb{R} $ such that, on the intervals that its not zero, it has a graph formed up by $n$ isosceles triangles whose vertices are $(r_1,1/q_1),\ldots,(r_n,1/q_n)$ and all basis of length $1/n$ (in such a way that no triangle do overlap) setted in the $x$-axis. Show that for all $x\in \mathbb{R}$ it is $\lim f_n(x)=f(x),$ where $f(x)=0$ for $x$ irrational and $f(x)=1/q$ if $x=p/q$ is irreducible. Futhermore, show that at no interval on the real line it is $f_n\rightarrow f$ uniformly.

I have been doing some draws to visualize what is happening. It seems pretty intuitive that the sequence of $f_n$ must converge to $1/q$ if $x=p/q$ is irreducible. But i'm really struggling when it comes to write down what i can visualize. I think that the most difficult aspect is to work with an arbitrary enumeration of rationals.
Any help?
 A: Suppose $x \in \mathbb{Q}$. Then $x=r_n$ for some $n \in \mathbb{N}$, so $f_m (x) := 1/q_n $ for every $m \geq n$.
Suppose now that $x \in \mathbb{R} \setminus \mathbb{Q}$. 
Then  $\forall q\in \mathbb{N},\exists! n'_q,n_q \in \mathbb{Z} \mbox{   such that   }\frac{n'_q}{q} \leq x \leq \frac{n_q}{q}$, with each side of inequality being irreducible and $n_q-n'_q$ being minimal. (*)
So, $\forall p\in\mathbb{N}$, we may take sufficiently large $n$ such that $f_n(x)$ does not belong to any triangle whose vertex's heigth is $\geq \frac{1}{p}$, since by (*) we have a finite number of rationals with this property closest to $x$, and the triangles don't overlap.  Since it holds for every $p \in \mathbb{N}$ we conclude that 
$$\forall p \in \mathbb{N}, f(x)\leq \frac{1}{p}.$$
Hence we conclude that $f(x) = 0$.
Since $f$ isn't continuous for every non-zero rational number (take some irrational sequence approximating the given rational), and $\mathbb{Q}\setminus  \{0\}$ is dense in R we infer that for any interval the convergence isn't uniform.
