Conceptual proof why a continuous surjective function $f: \mathbb R \setminus \mathbb Q \to \mathbb N$ can exist I know that a  continuous surjective function $f: \mathbb R \setminus \mathbb Q \to \mathbb N$ does in fact exist, but I do not know how I can construct it — I mean, how do I even attempt to do this? My only idea was something like this: 
1. Choose any two integer values $i, j$ and find an irrational number between them  
2. Set the value of the function of this irrational number to a natural number $n$. 
3. Make the function map all irrational numbers between $i$ and $j$ map to $n$ 
4. Repeat this process infinitely many times, always choosing a different $n$, $i$ and $j$. This way we will cater for the entire set of natural numbers, without running out of the points in the domain ($continuum > \aleph_o$)

I am making use of the fact that my function is not defined at $x \in \mathbb N$, therefore I can "jump" with its value without losing the continuity property.  
What do you think of this? Is it a correct construction?
 A: Your construction looks fine. Specifically, you can just use the floor or ceiling functions (and say that any negative number gets mapped to $0$). You do, of course, actually have to go through an $\epsilon$-$\delta$ thing or similar to prove that it is continuous, but it shouldn't be too much work.
A: The idea looks fine. You can make it work as follows: define $f(x)=1$ if $x<1$, $f(x)=2$ if $1<x<2$, $f(x)=3$ if $2<x<3$, $f(x)=4$ if $3<x<4$, and so on.
A: Essentially, your approach is correct. We can be a little bit more systematic (in your approach, what happens if we first choose $i=1$ and $j=3$, and then $i=0$ and $j=2$, so the two  intervals $(i,j)$ overlap? What if we choose an irrational number whose value has already been set?) by using the function $\lfloor x \rfloor$, which, for any $i \in \mathbb{N}$, maps irrational numbers between $i$ and $i+1$ to $i$. This is equivalent to always choosing intervals $(i,i+1)$ in your approach.
We can now prove continuity a bit more rigorously than you have. The preimage of any $i \in \mathbb{N}$ is an open set because it is the intersection of $(i,i+1)$ with $\mathbb{R}\setminus\mathbb{Q}$. The preimage of any set $N \subset \mathbb{N}$ is a union of these open sets and is thus open. Therefore the preimage of an open set is open, so the function is continuous.
A: $\mathbb{R}\setminus \mathbb{Q}$ is homeomorphic to $\mathbb{N}^\omega$ in the product topology. 
We can use any projection as a map as sought. You proposed map is essentially the $0$th projection, if you use the homeomorphism via continued fractions. 
