TITLE: Polynomial representing all nonnegative integers
QUESTION [288 upvotes]: Lagrange proved that every nonnegative integer is a sum of 4 squares.
Gauss proved that every nonnegative integer is a sum of 3 triangular numbers.
Is there a 2-variable polynomial $f(x,y) \in \mathbf{Q}[x,y]$ such that $f(\mathbf{Z} \times \mathbf{Z})=\mathbf{N}$?

REPLY [25 votes]: After thinking about this problem for a bit using rather a naive approach, looking at regions where f grows faster than quadratically (as mentioned in Qiaochu's attempt), it certainly appears that obtaining a negative answer to this problem is very difficult. To obtain a positive answer might be easier since we only need to exhibit a single polynomial with $f(\mathbb{Z}\times\mathbb{Z})=\mathbb{N}$ although, in all likelihood, there do not exist such examples. However, even using the naive approach, it quickly becomes clear what kind of behaviour could lead to a polynomial f having the required properties. Polynomials of degree less than four can be quickly dismissed. Then, assuming f has degree 2n, look at the leading order terms $f_{2n}$, which is a homogeneous polynomial of degree 2n. Away from the zeros of $f_{2n}$, it grows at rate $R^{2n}$ ($R=\sqrt{x^2+y^2}$) and dominates the lower order terms, so f cannot cover a strictly positive density of the integers. The difficulties occur when we look close to certain curves which are asymptotic to the zeros of $f_{2n}$ (being homogeneous, the zeros of $f_{2n}$ lie on a finite set of lines radiating out from the origin). On such curves, $f_{2n}$ will grow at a rate less than $O(R^{2n})$ and cancellation with lower order terms can occur. Looking at how much cancellation can occur seems to lead to difficult problems of Diophantine approximation.
The kind of polynomial which are plausible candidates for a polynomial mapping onto the positive integers are as follows.
$$
f(x,y)=a\prod_{i=1}^d\left(x-\alpha_iy\right)^{2n} - q(x,y)\qquad\qquad{\rm(1)}
$$
where $\alpha$ is a real algebraic integer with minimal polynomial of degree $d > 2$ over the rationals and conjugates $\alpha_1,\cdots,\alpha_d$, $a$ is a positive integer, and $q(x,y)$ is a polynomial of degree $2n(d-2)$. By Dirichlet's theorem, we know that there are infinitely many integer x,y such that $\vert x/y-\alpha_i\vert < y^{-2}$, so the leading order term of (1) is less than some fixed multiple of $R^{2n(d-2)}$ infinitely often. So there will be some cancellation with q. On the other hand, by the Thue-Siegel-Roth theorem, we know that $\vert x/y-\alpha\vert > y^{-2-\epsilon}$ for all large x,y, so the leading order terms of (1) grow at least as fast as $O(R^{2n(d-2)-\epsilon})$ which, at least, means that (1) cannot go negative very quickly. The question then, is there an algebraic number $\alpha$ such that $\vert x/y-\alpha\vert\ge cy^{-2}$ for some positive constant c and all integer x,y? In that case, the leading order term of (1) would be bounded below by a multiple $R^{2n(d-2)}$ and q could be chosen such that $f(\mathbb{Z}\times\mathbb{Z})\subseteq\mathbb{N}$. It is then possible, but still unlikely, that (1) gives a polynomial mapping onto the positive integers. Looking in my copy of Hindry & Silverman (Diophantine Geometry, An Introduction) it mentions that it is an open problem whether there exist such algebraic numbers (and there are no known examples or counterexamples with $d > 2$) but it is conjectured that there aren't any. So, polynomials such as (1) appear unlikely to do what we want, but proving this seems to be very difficult. Of course, that f actually covers $\mathbb{N}$ would be a much stronger statement than $\vert x/y-\alpha\vert \ge cy^{-2}$ so, maybe an expert in this area could actually rule out such examples, but it still looks like a very tricky problem.
We can also try polynomials such as
$$
f(x,y)=a\prod_{i=1}^d\left((x-\alpha_iy)^r-p(\alpha_i)y^s\right)^{2n} - q(x,y)\qquad\qquad{\rm(2)}
$$
where, now, p is a polynomial with integer coefficients,r,s are positive integers and q has degree less than $2n$. This is even more difficult than (1) to deal with and whether or not such polynomials can provide what the question is asking for depends on how small $(x/y-\alpha)-p(\alpha)^{1/r}y^{s/r-1}$ can be. This also looks like a very difficult problem in Diophantine approximation.
So, although I expect that the answer to this is no, there are no such $f$, any method of proving this has to cope with possibilities such as (1) and (2). Just these two cases look extremely difficult to handle. Maybe it is possible though, and an expert on such areas would be able to say something more about them than I can.