Image of polynomial is $\mathbb{Q}$ I know that the polynomial $f(x)=\frac{1}{2} x^2 + \frac{1}{2}x \in \mathbb{Q}[x] $ has that $f(\mathbb{Z})\subset\mathbb{Z}$.
My question is a bit different: Does there exist a polynomial $f \in \mathbb{R}[x]$ such that $f(\mathbb{Z}) = \mathbb{Q}$? What about a polynomial that $f(\mathbb{Q}) = \mathbb{Z}$? 
I suspect that both polynomials do not exist, but I do not know how to prove it.
 A: there is no polynomial $f$ such that $f (\Bbb{Q}) = \Bbb{Z}$:
Suppose $f(X)=a_nX^n+...+a_1X+a_0$ is such a polynomial,  then $f
(0) =a_0= n_0\in \Bbb{Z}$, so the polynomial
$g_1(X)=\frac{(f-n_0)(X)}{X}(\Bbb{Q})\subset  \Bbb{Z} $ and then result
$g_1(O)= a_1 = n_1\in \Bbb{Z}$, by repeating this reasoning $f$ to be
an element of $\Bbb{Z}[X]$, let   $m = lcm(n_i)$ then for suitable m' depending to m , $f (1 / m')\not\in
\Bbb{Z}$.
using the same reasoning if $f$ is such that $f (\Bbb{Z}) =
\Bbb{Q}$, then $f$ is in $\Bbb{Q}[X]$,  and  the fiber $f^{-1}
(x)$ is empty for all $x \in \Bbb{Q}\cap] f (n), f (n + 1)[$ for
suitable $n$.
A: 1st question: non-constant polynomials have infinite limits as $n\to\infty$, so can talk only finitely many values in the interval $(0,1)$, so no polynomial can take all rational values in $(0,1)$. (by @ThomasAndrews)
2nd question: $f(\mathbb{Q})$ is dense in $f(\mathbb{R})$ which is connected, so we cannot have $f(\mathbb{Q})=\mathbb{Z}$. (by @GEdgar) 
If you prefer a non-topological argument, the result obviously holds for $f$ constant. So $f'$ has only finitely many roots. Take $a$ such that $f'(a)\ne0$, then for large enough $n$, $f(a+\frac{1}{n})-f(a)$ cannot be an integer - it must converge to 0, but a non-trivial sequence of integers cannot do that. (by @ErickWong and @Hmm.).
