Does there exist a sequence of continuous functions converging to $f$? Let $g:\mathbb{N}\to\mathbb{Q}$ be a bijection. Let $f:\mathbb{R}\to\mathbb{R}$ be defined in the following way:
$$f(x)=\begin{cases}
1/g^{-1}(x) & x\in\mathbb{Q}\\
0 &x\not\in\mathbb{Q}
\end{cases}$$
I have shown that $f$ is continuous at each $x\not\in\mathbb{Q}$ and not continuous at each $x\in\mathbb{Q}$. However, I am wondering if there is a sequence $\{f_n\}$ of continuous functions which converges pointwise to $f$. I would imagine that if there was, it would be similar to the construction in this question, concerning Thomae's function, but I cannot make that work because Thomae's function is constructed differently. A hint would be appreciated. 
 A: Let $Q_n = \{q_1,\ldots,q_n\} \subset \mathbb{Q}$ be the first $n$ rational numbers in the $g$ enumeration ($g(j) = q_j$). Let $f_n(x)$ be the continuous function whose value is $\frac{1}{n}$ in $q_n$ and zero elsewhere. This is easily done since $d = \inf\{ |q_i-q_j|, i\neq j\}$ is positive and thus the function could be described as a colection of triangles with width no greater then $2d$. Let $\eta(x)$ denote the nearest member of $Q_n$ within $d$ distance or $0$ (one could describe as $0$ if $B_x(d) \cap Q_n = \emptyset$   or $q_n$ if $B_x(d) \cap Q_n = \{q_n\}$), then $f_n(x)$ could be described as:
$f_n(x) =  \frac{1}{g^{-1}(\eta(x))}\left (1- \frac{|\eta(x)-x|}{d}\right)$
For example, if $x = q_n \pm d/k$ for some $k>1$, then $\eta(x) = q_n$ and $f(x) = \frac{1}{n} \left (1 - \frac{1}{k} \right)$
In particular $f(q_n) = \frac{1}{n}$, $f_n$ is continuous and $f_n \to f$ pointwise.
A: That question about Thomae's function is the hint. On the $n$-th step, approximate $g(n)$ by a triangle. Then clearly $f_n \to f$ on $\mathbb{Q}$.
For $x \in \overline{\mathbb{Q}}$, let $\varepsilon > 0$ and let $\delta > 0$ be such that if $|x - g(n)| < \delta$ then $1/n < \varepsilon$. Let's say the triangles in $f_n$ have a width smaller than $1/2^n$ ($1/n$ should also be suitable). Now choose $n$ sufficiently large such that $1/2^n < \delta$. Then if $f_n(x)$ is on some triangle, that triangle has to come from a $g(n)$ with $|x - g(n)| < \delta$ and therefore $1/n < \varepsilon$; the other triangles will be too far away (make this precise). It follows that $f_n(x) < \varepsilon$ and hence $f_n(x) \to 0$ as $n \to \infty$.
