$ \text{Let}$$ P(n) \text{be permutation of}$$ (1,2 \dots n)$$ \text{such that if}$$ P(n)={a_1,a_2, \dots a_n} $$ \text{then} $$(a_i+a_{i+1})=k^2$$ \text{where}$$ k\in \mathbb{N}$ and $i \in {1,2,3, \dots n-1}$.$\text{Find the generalized form of n}$.
All I could do is to stare at the problem and try out some examples. I could not think of anything general about the numbers which obeyed the property.Here are two of the examples, for $n=17,16$:
${8,1,15,10,6,3,13,12,4,5,11,14,2,7,9,16}$
${17,8,1,15,10,6,3,13,12,4,5,11,14,2,7,9,16}$
Poking around the internet, this Stack Overflow answer links to A090461 on OEIS, and the latter seems to indicate that this is an open problem.
Judging from the OEIS page (the Stack Overflow answer references it too), it is conjectured that there exists such a permutation for all $n > 24$. It also confirms that 15, 16, 17, and 23 are the only $n < 25$ for which a permutation exists.