# $n$ or $2n$ is a sum of three squares

For a given positive integer $$n$$, show that $$n$$ or $$2n$$ is a sum of three squares.

My attempt: If $$n$$ is a sum of three squares, there is nothing to prove. So assume $$n$$ is not a sum of three squares. Then $$n\equiv7\pmod8\implies 2n\equiv6\pmod8$$. I'm completely stuck here. I know that no positive integer of the form $$4^a(8b+7)$$ can be written as sum of three squares. My textbook (Elementary Number Theory- David Burton)doesn't give the proof of the converse of the statement,but mentions that the converse is true. The question is from the same book. So are we supposed to use the full theorem?(Alex has already given a proof using the converse.) Is there any way to proceed without using the converse of the theorem? Thanks.

• Could you please recall exactly what you know regarding sum of three squares. It seems you might know Legendre's three-squares theorem, but you do not recall it correctly. – quid Oct 15 '18 at 17:29
• In general, it is a good practice to provide a little context for the questions you post: this helps other members help you by giving perhaps the answer you are searching for. – Daniele Tampieri Oct 15 '18 at 17:37

So $$x$$ is the sum of three squares iff $$x$$ is not of the form $$4^a(8b+7)$$ via Legendre's theorem. Suppose $$n$$ is not the sum of three squares, so that $$x=4^a(8b+7)$$ for some integers $$a,b$$. Then $$2x=2\cdot 4^a(8b+7)$$. Notice that $$8b+7$$ is always odd. So it's not possible that $$2x=4^c(8d+7)$$, as $$c=a$$ necessarily, e.g. $$2\cdot 4^a=4^c$$ is impossible.