# Integers around a circle with consecutive pairs adding to a square

The integers 1 to 50 are placed around a circle in such a way that the sum of any two of them which are adjacent is a perfect square. Of these integers, the even numbers are then removed. Restore them.

• This must have been a lot of work to create this circle. How did you do that? Commented Nov 19, 2017 at 3:14
• @A.P. I suspect it's significantly less work if you develop a short computer program to do it for you. ;) Commented Nov 19, 2017 at 7:43
• Man, this is a really cool puzzle. I like this puzzle! Commented Nov 19, 2017 at 13:25
• Freddy Barrera and Carlos Zuluaga (Colombia Aprendiendo), the creators of this puzzle, began by studying the graph whose vertices are the integers 1 to 50, two of which are joined by an edge if their sum is a square. By extensive computer search they found hamiltonian circuits in it, and then verified that removing even integers in this particular circuit, allowed the circuit to be uniquely restored. Expect other variants soon! Commented Nov 20, 2017 at 2:21
• @BernardoRecamánSantos if this wasn’t your puzzle could you please provide a link to where you found it? Commented Nov 20, 2017 at 7:45

Write down all square numbers $< 100$, so that you get an overview over all differences between them: $1$, $4$, $9$, $16$, $25$, $36$, $49$, $64$, $81$.
Now fill in the numbers in circles where all adjacent numbers are given. This is done by calculating the difference of the known numbers and picking two square numbers with the same difference. For example the difference between $37$ and $5$ is $32$, which is the same as $81 - 49$. Hence, the number in between must sum up to $49$ with the lower number and to $81$ with the higher one. $49 - 5 = 44$ can be filled there. After doing this at all possible positions, the circle looks like this:
Now one needs to use the knowledge that all numbers are even and occur only once. Therefore, pick a high known number, like $47$ and realize that the only possibilities for the square are $49$ and $81$, whereas for $49$ one would need a $2$, which is already taken. So one can fill in $81 - 47 = 34$ here. Then one can close the gap to the $19$ as in Step 1. Finally you get this: