# $n,p \in \mathbb{N}$ , $p$ prime and $1+np$ perfect square $\implies n+1$ is the sum of $p$ perfect squares.

I was looking to the following problem of Spain's mathematics olympiad (for high-school students):

Let $n,p$ be positive integers with $p$ prime such that $1+np$ is a perfect square. Then $n+1$ is the sum of $p$ perfect squares.

Can you give me any hints to solve it. In principle, I've thought of double induction, formula for the sum of squares...

• Is it not allowed to use the fact that any non-negative integer is a sum of 4 squares? – Hw Chu Feb 28 '18 at 18:50
• Can you solve the case $p=2$? – Hagen von Eitzen Feb 28 '18 at 18:53

If $1 + np = m^2$, then $m \equiv \pm1 \pmod p$, hence $m = lp\pm 1$ for some $l$. Then $np = lp(lp\pm2)$, so $n = l^2p\pm2l$, so $$n+1 = \underbrace{l^2 + l^2 + \cdots + l^2}_{p-1 \text{times}.} + (l \pm 1)^2.$$