Is there a rational surjection $\Bbb N\to\Bbb Q$? The question is in the title. Is there a one-dimensional rational function $f\in\Bbb R(X)$ which restricts to $\Bbb N\to\Bbb Q$, which is a surjection onto $\Bbb Q$? My guess is no.
Expanding the scope a little (at the expense of precision), are there any "nice" functions that enumerate $\Bbb Q$? Here "nice" is meant to exclude the floor function or absolute value function and related trickery. At first I thought it might work to use analytic functions here, but there is an analytic function taking any chosen values on $\Bbb N$ subject to a mild growth hypothesis (I think $f(n)\in o(n)$), by defining $f(z)=\sum_{n\in\Bbb N}a_n{\rm sinc}(\frac{z-n}\pi)$, where ${\rm sinc}(z)=\frac{\sin(z)}z$ continuously extended over zero. I will let answerers supply their own definitions of "nice" if they want to tackle the broader question.
 A: At least for the question of a rational function $\Bbb N\to\Bbb Q$, the answer is no. In fact, we can make a stronger claim:

If $f:\Bbb N\to\Bbb R$ is a rational function, then the range of $f$ is either bounded above or bounded below.

Proof: Separate the highest order term of $f$, writing it as $f(x)=ax^n+g(x)$ where $g\in o(x^n)$ for some $n\in\Bbb Z$. If $a\ge 0$, then we claim $f$ is bounded below (and by symmetry, $f$ is bounded above if $a\le 0$).
By the definition of little-O, there is some $N\in\Bbb N$ such that for all $x>N$, $|g(x)|\le ax^n$. Then $f(x)\ge0$, so $f(x)\ge\min\{f(0),f(1),\dots,f(N)\}$.
Edit: Alternatively, we can use Arnaud's suggestion: the derivative of $f$ is also a real rational function, which only changes sign at the roots of the numerator and denominator. Thus $f$ is monotone above the largest root of the derivative (let's say $f$ is increasing, the other case is covered by symmetry), so $f$ is eventually bounded below, and hence bounded below by the same argument as above.

The analytic function example in the OP can be extended to functions with any polynomial growth rate. Define ${\rm sincz}(z)={\rm sinc}(\frac z\pi)=\frac\pi z\sin(\frac z\pi)$. This function has the property ${\rm sincz}(0)=1$ and ${\rm sincz}(n)=0$ for all other $n\in\Bbb Z$. Additionally, since $|\sin(x)|\le 1$ on $\Bbb R$, $|{\rm sinc}(x)|\le\frac 1x$ and $|{\rm sincz}(x)|\le\frac\pi x$. To achieve even higher convergence rates, we can take ${\rm sincz}^n(x)$, which also has the same behavior on integers but is $O(x^{-n})$.
The convergence rate is necessary to ensure that $\sum_{n\in\Bbb N}a_n{\rm sincz}^m(z-n)$ converges. If $a_n$ is $O(n^k)$, then $a_n{\rm sincz}^m(z-n)$ is $O(n^{k-m})$, so the sum converges for $m>k+1$. Then as a uniformly convergent sum (uniformly because it is using a global bound on ${\rm sincz}$) of analytic functions, it is itself analytic, and takes the value $f(n)=a_n$ at each integer. Needless to say, most constructed bijections $\Bbb N\to\Bbb Q$ have polynomial growth, usually $O(n^{1/2})$, so this shows that there is an analytic function whose restriction to the natural numbers is a bijection to $\Bbb Q$, although it is quite contrived and does not really "simplify" the expression.
A: This is an alternative argument based on Arnaud's suggestion. Without loss of generality, you can assume the rational function $f$ is $\frac{p}{q}$ where $n = \deg(p) \ge \deg(q) = m$ (otherwise trade $f$ in for $\frac{1}{f}$). But then (using $(\frac{p}{q})' = \frac{p'q - pq'}{q^2}$) you have:
$$
f'(x) = \frac{(n-m)p_nx^{m+n-1} + \mbox{terms of lower degree}}{x^{2m} +  \mbox{terms of lower degree}}
$$
where, without loss of generality, I have assumed $q$ is monic and where $p_n \neq 0$ and $n > 0$ (if $n = 0$, $f$ is constant).
So as $x$ tends to $\pm\infty$, $f'(x)$ tends to $\pm\infty$, if $n > m+ 1$, and to $p_n \neq 0$ if $n = m + 1$. So $f(x)$ is monotonic whenever $|x|$ is sufficiently large if $n > m$. If $m = n$, then as $x$ tends to $\pm\infty$, $f(x)$ tends to $\pm p_n$, so $f(x)$ is bounded. But if $f(x)$ is either monotonic for large enough $|x|$ or bounded, then $f$ cannot map $\Bbb{N}$ onto $\Bbb{Q}$.
A: If nice is taken to mean analytic function there sure is. There exists a result from complex analysis that states that if $\lim_{n\to\infty} c_n=\infty$ and $a_n$ is a sequence of complex number then there's an analytic functionn $f$ such than $f(c_n) = a_n$. Now let $c_n = n$ and $a_n$ be an enumeration of $\mathbb Q$ then this result guarantees the existence of such a function.
