4
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Hint: en.wikipedia.org/wiki/Lagrange%27s_four-square_theorem $\endgroup$ – aGer Jul 10 '15 at 14:33
  • $\begingroup$ @aGer How is lagrange's theorem helpful here? Does it give a method on how to actually write a number as sum of four squares, or merely existence? $\endgroup$ – pMarkov Jul 10 '15 at 14:36
  • $\begingroup$ Not a method, actually. But the AFAIK the theorem states that every natural number can be expressed as the sum of four squares. $\endgroup$ – aGer Jul 10 '15 at 14:38
  • $\begingroup$ Is $0=0^2$ an acceptable square? $\endgroup$ – Gary. Jul 10 '15 at 14:39
  • 1
    $\begingroup$ $2104 $ or $2014$ ? $\endgroup$ – lhf Jul 10 '15 at 14:43
1
$\begingroup$

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. $$

$\endgroup$
  • $\begingroup$ corrected arithmetic mistake, now corrected to $42$ rather than $52$ $\endgroup$ – Will Jagy Jul 10 '15 at 15:56
1
$\begingroup$

$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$

$\endgroup$
0
$\begingroup$

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

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.