Express 2104 as the sum of four squares

892 Views Asked by At

How to write 2104 as the sum of four squares.

I know the general equation for factoring a number into the sum of four squares but I don't know how to go about this when some of the prime factors are large, for example, one of 2104's prime factors is 263 and I can't figure out how to write 263 as the sum of four squares.

4

There are 4 best solutions below

1
On BEST ANSWER

very easy by computer, and the way to go if you need all such representations. By hand, the first thing is that the $w^2 + x^2 + y^2 + z^2$ can be divisible by $4$ with all entries odd, as $1+1+1+1=4$ for example, but if divisible by $8$ all entries must be even. So, we are going to write $2104 / 4 = 526$ as the sum of four squares and double those entries.

Next, $23^2 = 529$ is too big. $22^2 = 484$ is small enough, and $526-484 = 42$ is the sum of three squares $42 = 25 + 16 + 1.$ So, $$526 = 22^2 + 5^2 + 4^2 + 1^2, $$ $$2104 = 44^2 + 10^2 + 8^2 + 2^2. $$

0
On

$2104$ is not of the form $4^a(8b + 7)$ and so by Legendre's three-square theorem it can be written as the sum of three squares. One way is $4^2+18^2+42^2$.

However, it may be simpler to use the norm in quaternions to reduce the problem to expressing the factors of $2104$ as a sum of four squares.

Now, $2104= 2^3 \cdot 263$ and $2=1^2+1^1$. So, it remains to express $263$. One way is $1^2+1^2+6^2+15^2$.

In any case, a simple brute-force search works quite fast and gives these decompositions of $2104$:

$0^2+4^2+18^2+42^2$

$0^2+12^2+14^2+42^2$

$0^2+18^2+22^2+36^2$

$2^2+4^2+22^2+40^2$

$2^2+8^2+10^2+44^2$

$2^2+10^2+20^2+40^2$

$2^2+16^2+20^2+38^2$

$2^2+20^2+26^2+32^2$

$4^2+16^2+26^2+34^2$

$6^2+12^2+18^2+40^2$

$6^2+12^2+30^2+32^2$

$6^2+14^2+24^2+36^2$

$8^2+10^2+28^2+34^2$

$8^2+14^2+20^2+38^2$

$8^2+20^2+22^2+34^2$

$10^2+14^2+28^2+32^2$

$12^2+22^2+24^2+30^2$

$14^2+20^2+22^2+32^2$

0
On

$36^2+24^2+14^2+6^2=2104$ is an answer here.

0
On

See http://www.alpertron.com.ar/4SQUARES.HTM for a good explanation of a reasonable algorithm to find it. The author also gives a Java implementation that you can experiment with. The algorithm is not deterministic but is simple to prove and implement. If I recall there are deterministic algorithms but they are quite complicated.