A quadratic polynomial with integer values implies another My friend ask me the following: Let $f,g$ be two quadratic polynomials. We know that for any $x\in\mathbb R$ then $g(x)\in\mathbb Z$ implies $f(x)\in\mathbb Z$. Then there exists $m,n\in\mathbb Z$ such that $f(x)=mg(x)+n$ for any $x$. 
I have no idea to prove this. Anyone could help me how?
 A: Without loss of generality, assume that the leading coefficients of both $f$ and $g$ are positive (if they aren't, just replace e.g. $f(x) \mapsto -f(x)$, this doesn't affect the hypotesis and the thesis).
Now, there exists an integer $k$ such that the integers $k, \: k + 1, \: k + 2, \: \dots$ all are in the image of $g$. For $n \ge 0$, define $x_n$ as the largest solution of the equation $g(x) = k + n$. Also, let $\delta_n = x_{n + 1} - x_n, \; n \ge 0$. It is quite obvious that $\lim_{n \rightarrow \infty} \delta_n = 0$ (you can convince yourself that this is true by graphing the situation).
Let $g(x) = ax^2 + bx + c$, $f(x) = a'x^2 + b'x + c'$. Then we have $$\begin{align*} 1 & = g(x_{n + 1}) - g(x_n) = g(x_n + \delta_n) - g(x_n) = \\ & = [a(x_n + \delta_n)^2 + b(x_n + \delta_n) + c] - [ax_n^2 + bx_n + c] = \\ & = 2ax_n\delta_n + a\delta_n^2 + b\delta_n \tag{1} \end{align*}$$ An identical computation shows that $$f(x_{n + 1}) - f(x_n) = 2a'x_n\delta_n + a'\delta_n^2 + b'\delta_n \tag{2}$$
Isolating $x_n\delta_n$ in $(1)$ and substituting it in $(2)$ gives $$f(x_{n + 1}) - f(x_n) = \frac{a'}{a}(1 - b\delta_n) + b'\delta_n$$
But for sufficiently large $n$ $\delta_n \rightarrow 0$, so the RHS is close to $\frac{a'}{a}$; on the other hand, $f(x_{n + 1}) - f(x_n)$ is certainly an integer, although this might not be always the same. Putting together these two observations, one deduces that, in fact, $\frac{a'}{a}$ must be an integer and, at least from a certain point on, $f(x_{n + 1}) - f(x_n) = \dfrac{a'}{a}$ (can you see why?).
From here we're almost done, and the rest of the proof is very straightforward, so I leave it to you.
