TITLE: Diophantine equation to characterize natural numbers
QUESTION [6 upvotes]: Let's consider
$$\Bbb N=\{0,1,2,3,\ldots\},$$
and, for each $k\in\{1,2,3,\ldots,\}$, let
$$o_k=2k-1$$
be the sequence of odd natural numbers.
Given that for each $m\in\Bbb N$, if $a$ is odd, the number
$$m(m+a)$$
is even, it is easy to see that
$$\begin{align*}
(x+y)^2 + y + 3x &= x^2 + 2xy + y^2 + y + 3x\\
&= x(x+3) + y(y+1) + 2xy
\end{align*}$$
is even.
Assuming that for arbitrary $x_1,\ldots, x_k\in\Bbb N$, the number
$$(x_1+\cdots + x_k)^2+x_k+3x_{k-1}+\cdots +o_kx_1$$
is even, we have that
$$\begin{align*}
& (x_1+\cdots + x_{k+1})^2+x_{k+1}+3x_k+\cdots +o_kx_1\\
&\qquad = (x_1+\cdots + x_{k})^2 +2(x_1+\cdots + x_{k})x_{k+1}+ x_{k+1}^2 + x_{k+1} + (x_k+\cdots + o_kx_{1}) +2(x_1+\cdots + x_{k}) \\
&\qquad = (x_1+\cdots + x_{k})^2 + (x_k+\cdots + o_kx_{1}) + x_{k+1}(x_{k+1}+1) + 2(x_1+\cdots + x_{k})(x_{k+1}+1)
\end{align*}$$
is even.
Therefore by induction, for each $k\geq 2$ we have that
$$\frac1{2}\left[(x_1+\cdots + x_k)^2+x_k+3x_{k-1}+\cdots +o_kx_1\right]$$
is indeed a natural number.
But, does this describes all natural numbers?
I mean, for a given $n\in\Bbb N$, does the equation
$$(x_1+\cdots + x_k)^2+x_k+3x_{k-1}+\cdots +o_kx_1=2n$$
have exactly one solution $(x_1,\ldots,x_k)\in\Bbb N^k$?

REPLY [2 votes]: Since $f(x,y)=\frac12[(x+y)^2+3x+y]$ is a bijection $\Bbb N\times\Bbb N\leftrightarrow\Bbb N$, we get that $g(u,v,w)=f(f(u,v),w)$ is a bijection $\Bbb N^3\leftrightarrow\Bbb N$. However, $g$ is of degree $4$ for $3$ variables.
Still, notice that for $k=2^r$ we can construct a bijection $h_r:\Bbb N^{2^r}\leftrightarrow\Bbb N$ that is of degree exactly $2^r$ in all variables, by putting:

$h_0(x)=x$
$h_{r+1}(x_1,\dots,x_{2^{r+1}})=f(h_r(x_1,\dots,x_{2^r}), h_r(x_{2^r+1},\dots,x_{2^{r+1}}))$