Problem

Source: Serbia JBMO TST 2017

Tags: number theory



Positive integer $q$ is the $k{}$-successor of positive integer $n{}$ if there exists a positive integer $p{}$ such that $n+p^2=q^2$. Let $A{}$ be the set of all positive integers $n{}$ that have at least a $k{}$-successor, but every $k{}$-successor does not have $k{}$-successors of its own. Prove that $$A=\{7,12\}\cup\{8m+3\mid m\in\mathbb{N}\}\cup\{16m+4\mid m\in\mathbb{N}\}.$$