**From New Scientist #2543, 18th March 2006**

I have a set of cards numbered consecutively from 1 up to and including my nephew’s age. I gave him the cards and asked him to arrange them in a row so that the sum of any adjacent pair was a perfect square. He managed it and reported that there were actually only two ways of doing it, namely the line-up which he had displayed and the complete reverse of that order.

I asked him if the same would have been true had he been one year younger and I had correspondingly given him one card fewer. He said that it would, and he produced the second line-up by simply removing the left hand card from his line-up. I asked him if the same would have been true if he had been two years younger and I had originally given him two fewer cards. He said that it would, and he produced the line-up by simply removing the right hand card from his line-up.

How old is my nephew, and what was the number on the middle card in the original line-up?

[enigma1383]

### Like this:

Like Loading...

This Python3 program considers increasing

nuntil it finds a solution. It runs in 60ms.Solution:Your nephew is 17. The number on the middle card is 12.OEIS sequence A090460, the number of essentially different permutations of the numbers 1 to n such that the sum of adjacent numbers is a square, reveals the age of the puzzler’s nephew (but not the middle card)