# Rational functions from integers to integers

A polynomial with integer coefficients maps integers to integers. A rational function (which is a quotient of two polynomials) tends to map integers to rational numbers. Other than the trivial case where the denominator is a factor of the numerator, are there any rational functions that map all integers to integers? What is known about them and how can they be found?

Let $$r(z) = \frac{p(z)}{q(z)}$$ such that $$r:\mathbb{Z}\rightarrow\mathbb{Z}$$ and $$p,q$$ polynomials. Then $$q(z)|p(z)$$ for all $$z \in \mathbb{Z}$$ and $$\deg p \geq \deg q$$ (check what happens at $$\infty$$).
You can check here, for example, how the division between polynomials over a commutative ring (like $$\mathbb{Z}$$) works.
So if $$q$$ is monic, then you can divide the polynomials, so $$p(z)=f(z)q(z)+g(z)$$ with $$f,g$$ polynomials and $$\deg g < \deg q$$. Then if $$g \not \equiv 0$$, $$r(z)=f(z)+\frac{g(z)}{q(z)}$$, so $$\frac{g(z)}{q(z)}$$ is also an "integer" rational function, which is absurd. So $$g\equiv0$$ and $$r$$ is a integer polynomial.
If $$q$$ is non-monic, you can apply the theorem of the linked answer: call $$q_0$$ the leading coefficient of $$q$$, then $$q_0^kp(z) = f(z)q(z) + g(z)$$. Consider the integer rational function $$q_0^kr(z) = \frac{q_0^kp(z)}{q(z)} = f(z)+ \frac{g(z)}{q(z)}$$. As above, this implies that $$g(z) \equiv 0$$. So $$r(z)=\frac{p(z)}{q(z)}=\frac{q_0^kp(z)}{q_0^kq(z)}=\frac{f(z)q(z)}{q_0^kq(z)}=\frac{f(z)}{q_0^k}$$. Then again $$r$$ is a integer polynomial.