I am learning Legendre's three-square theorem , to check if a number can be written in a 3 square form.
I have to check if the number is in the form $4^{a}(8b+7)$.
How to do this efficiently ? For odd the answer is no.
I am learning Legendre's three-square theorem , to check if a number can be written in a 3 square form.
I have to check if the number is in the form $4^{a}(8b+7)$.
How to do this efficiently ? For odd the answer is no.
If a number is a sum of $3$ squares, it cannot be of the form $4^a(8b+7)$
Proof :
Suppose, $N=4^a(8b+7)=u^2+v^2+w^2$
Every perfect square is congruent $0$ or $1$ modulo $4$, so $u,v,w$ must be even, as long as $a>0$. Therefore, we can divide by $4$ until we get
$8b+7=u'^2+v'^2+w'^2$
But this cannot hold because every perfect square is congruent to $0,1$ or $4$ modulo $8$