[Math] Arrangement of integers in a row such that the sum of every two adjacent numbers is a perfect square.

exponentiationgraph theorynumber theorypermutationssquare-numbers

Inspired by this interesting question and in order to solve an old problem, I have the following question:

Can we construct a strictly increasing sequence $(N_i)_{i\in \mathbb{N}}$, such that for every integer $i$, we can arrange all the numbers from 1 to $N_i$, in a row such that the sum of every two adjacent numbers is a perfect square.

The first term of the sequence cannot be less than $14$, so we can take $N_0=15$:
$$8,1,15,10,6,3,13,12,4,5,11,14,2,7,9$$
And we can take also $N_1=16$ because we can add $16$ at the end, and $N_2=17$ by adding $17$ in the beginning (@mathlove). And as pointed by @gnasher729 in his answer we can not take $N_3=18$.

This is related to the connectedness of a graph, if we consider the graph $G_N = (V, E)$ with $V=\{1,\cdots,N\}$ and $\{i,j\}\in E$ if and only if $i+j$ is a square, The question is equivalent to prove that $G_N$ have a Hamiltonian path for large integers $N$.

Edit I updated the question, I hope it's very clear and more direct.

Best Answer

Look at the numbers 16, 17, 18: We have 16 < 16+x < 36, 16 < 17+y < 36, 16 < 18+z < 36. Therefore 16+x = 17+y = 18+z = 25, making x = 9, y = 8, z = 7. Therefore each of these numbers has only one possible neighbour and therefore must be the first or last of the sequence. Which is not possible, since we have three of them.

(Sorry, doesn't quite answer the question. )

Related Question