show/hide this revision's text 2 added 115 characters in body

Here's another simple explicit function that maps the irrationals onto the real numbers.

Consider the continuous piece-wise linear function $f:\mathbb{R}\rightarrow\mathbb{R}$, with slope $f'(x)=-1$ or $f'(x)=+1$ according whether $\lfloor x/\sqrt 2\rfloor=0\ \mathrm{ mod} 3 $, or not (like this). So $f(x)=x/3+O(1)$ as $|x|\to\infty$ and it is therefore surjective; precisely, any of its fiber has three points, and the arithmetic mean of some two of these is an odd multiple of $\sqrt{2}$. This means that the equation $f(x)=c$ has always an irrational solution, whatever is $c\in\mathbb{R}$.

show/hide this revision's text 1

Here's another simple explicit function that maps the irrationals onto the real numbers.

Consider the continuous piece-wise linear function $f:\mathbb{R}\rightarrow\mathbb{R}$, with slope $f'(x)=-1$ or $f'(x)=+1$ according whether $\lfloor x/\sqrt 2\rfloor=0\ \mathrm{ mod} 3 $, or not. So $f(x)=x/3+O(1)$ as $|x|\to\infty$ and it is therefore surjective; precisely, any of its fiber has three points, and the arithmetic mean of some two of these is an odd multiple of $\sqrt{2}$. This means that the equation $f(x)=c$ has always an irrational solution, whatever is $c\in\mathbb{R}$.