A continuous surjection from irrational numbers to Cantor's set I wonder if there exists such a function that is continuous and surjective $$f:\mathbb{R} \setminus \mathbb{Q} \rightarrow C$$ where $C$ is the Cantor's set. 
When I did such an exercise but for $f:C \rightarrow \mathbb{R} \setminus \mathbb{Q}$, it wasn't that hard, because $\mathbb{R} \setminus \mathbb{Q}$ isn't a compact set then a continuous function from Cantor's set on it doesn't exist. A similar reason was for $f:C \rightarrow  \mathbb{Q}$.
I tried to use compactness, connectedness or connected components (to show there is no such a function) but I got no results.
 A: Define $f\colon \mathbb{Q}^c \to C$ as follows:


*

*For $x\in (-\infty,1)\cap \mathbb{Q}^c$, let $f(x)$ be the closest point in $C$ to $x$, with $f(x) = x$ if $x\in C$.  For example, points in $(1/3,1/2)$ map to $1/3$, and points in $(1/2,2/3)$ map to $2/3$.

*For $x\ge 1$, let $f$ map the interval $(n,n+1)\cap \mathbb{Q}^c$ to $q_n$, where $q_1,q_2,\ldots$ is an enumeration of the rational points of $C$.
It is easy to check that $f$ is continuous and surjective.
A: You may use just a variant of the Minkowski question mark function, by sending an irrational number $\alpha\in\mathbb{R}^+$ with continued fraction representation given by
$$ \alpha=\left[\alpha_0;\alpha_1,\alpha_2,\alpha_3,\ldots\right] $$
into:
$$ f(\alpha) = \sum_{n=1}^{+\infty}\frac{2}{3^{\alpha_0+\ldots+\alpha_n}}\in C.$$
A: Every irrational number can be expressed as a continued fractions $[a_0; a_1, a_2, \dotsc]$ and moreover the irrational numbers are homeomorphic to the countable product of the integers, so map it to $$\sum_{i=0}^\infty {1 + (-1)^{a_i} \over 3^i}$$ Surjectivity is obvious.
