Problem

Source:

Tags: number theory



It is said that a positive integer is not GOOD, if there exists a permutation of the integers from 1 to n, $(a_1,a_2,...,a_n)$ such that $k + a_k$ is a perfect square for all $k$. For example $5$ is a GOOD number, since the permutation $(3,2,1,5,4)$ checks the condition: $1 + 3 = 2^2$, $2 + 2 = 2^2$, $3 + 1 = 2^2$; $4 + 5 = 3^2$ and $5 +4 = 3^2$. Find all GOOD numbers up to $12$.