# If N is a sum of two squares, then so is the odd part of N

Given two natural numbers $m,n$, where $m$ is odd. Please prove that if $m\cdot2^n$ is a sum of two squares, then $m$ is a sum of two squares. Tested for all $m\cdot2^n<100,000$.

I love the natural numbers but feels number theory being inapproachable. So I'm experimenting and mostly (mis)use ME as a "proof calculator". While testing and using my BigZ I analyze sets and sequences of numbers like below.

1 1000 ~ :| n | n sqrsum ; intcond  \ create all square sums in intervall
function odd-part transform-set     \ transform to odd parts
zdup cardinality . 153
condition sqrsum filter-set         \ only square sums filter
zdup cardinality . 153              \ conclude the conjecture in the question
condition noprime filter-set        \ remove all primes from the set
condition nosqr filter-set          \ remove all squares
set-of-factors                      \ create the set of all prime factor-tuples
cr zet.                             \ and print it:
{(5,197),(3,3,109),(5,193),(13,73),(5,5,37),(3,3,101),(5,181),(17,53),(3,3,97),(5,173),(5,13,13),(7,7,17),(3,3,89),(13,61),(5,157),(3,3,5,17),(5,149),(5,5,29),(17,41),(13,53),(5,137),(3,3,73),(7,7,13),(17,37),(5,11,11),(3,3,5,13),(5,113),(3,3,61),(5,109),(13,41),(5,101),(17,29),(5,97),(13,37),(3,3,53),(5,89),(5,5,17),(3,3,3,3,5),(13,29),(3,3,41),(5,73),(3,3,37),(5,5,13),(5,61),(5,53),(3,3,29),(5,7,7),(13,17),(5,41),(5,37),(3,3,17),(5,29),(5,5,5),(3,3,13),(5,17),(5,13),(3,3,5)} ok


From the remaining set the Sum of Two Squares Theorem is almost visible.

Also see my blog about using the most low level high level language Forth for mathematical calculations with sets and big integers.

• what has been tried ? what is known that way anyone answering can avoid telling you things you know. – user451844 Jul 28 '17 at 22:30
• Hint: an even square cannot be the sum of two odd squares (why?). – dxiv Jul 28 '17 at 22:33
• – G Tony Jacobs Jul 28 '17 at 22:35
• @GTonyJacobs, thanks! ME is my teacher in number theory. – Lehs Jul 28 '17 at 22:43
• @Lehs you could also look at : mersenneforum.org/forumdisplay.php?f=132 first – user451844 Jul 28 '17 at 23:04

$$(a-b)^2 + (a+b)^2 = 2(a^2 + b^2)$$
If even $n$ is the sum of two squares, then both are odd or both even; taking $n = c^2 + d^2,$ $$\frac{n}{2} = \left( \frac{c-d}{2} \right)^2 + \left( \frac{c+d}{2} \right)^2$$
The same things apply for any prime $p \equiv 1 \pmod 4.$
$$(2a+b)^2 + (a-2b)^2 = 5 (a^2 + b^2)$$
If $n$ is divisible by $5$ and $n = c^2 + d^2,$ then either both $c,d$ are divisible by $5$ or there is a relation (possibly requiring changing the order and perhaps a $\pm$ sign) of type $d \equiv 2 c \pmod 5.$ Then $$\frac{n}{5} = \left( \frac{2c-d}{5}\right)^2 + \left( \frac{c+2d}{5} \right)^2$$