Associated Topics || Dr. Math Home || Search Dr. Math

### Sum of Two Squares

```
Date: 12/04/97 at 00:07:46
From: Mary Writz
Subject: Sum of two squares

Here is a problem we have been working on in my math class.

The number 65 can be expressed as the sum of two squares in two
different ways: 65 = 8'2 + 1'2 = 7'2 + 4'2.

What is the smallest number that can be expressed in twelve different
ways as the sum of two squares?

Any help would be greatly appreciated.
```

```
Date: 12/04/97 at 10:11:32
From: Doctor Rob
Subject: Re: Sum of two squares

I assume you do not consider 8^2 + 1^2 = 65 = 1^2 + 8^2 different
ways, but see below if this assumption is false.

I assume you mean the squares of nonnegative numbers, else you would
say that 65 can be expressed as the sum of two squares in eight
different ways. Again, see below if this assumption is false.

If a number 2*n has k > 0 representations in this form, then n will
also have k representations, and be smaller, so we can eliminate all
even n's. Likewise, if p*n has k > 0 representations in this form, and
p is of the form 4*j+3, then p|n, and N = n/p = (p*n)/p^2 will also
have k representations, and be smaller, so we can eliminate all n's
with such a prime factor. Thus our attention is focused on n's all of
whose prime divisors have the form 4*j+1.

Now any such n which has 24 divisors would have this property. If the
factorization looks like Product(p(i)^(e(i))) for i = 1 to s, then the
number of divisors will be Product(e(i)+1) for i = 1 to s.  For this
to equal 24, there are seven possibilities:

Factors   s   e(1)  e(2)  e(3)  e(4)
24      1    23
12*2     2    11     1
8*3     2     7     2
6*4     2     5     3
6*2*2    3     5     1     1
4*3*2    3     3     2     1
3*2*2*2   4     2     1     1     1

Clearly using the smallest primes with the largest exponents is best,
so p(1) < p(2) < p(3) < p(4). The four smallest primes congruent to
1 mod 4 are 5, 13, 17 and 29.  Thus our candidate numbers are:

a = 5^23,
b = 5^11*13,
c = 5^7*13^2,
d = 5^5*13^3,
e = 5^5*13*17,
f = 5^3*13^2*17,
g = 5^2*13*17*29.

It turns out that g < f < e < d < c < b < a, so apparently g is the
answer. It is certainly true that g has 12 different expressions as
the sum of two squares of nonnegative numbers:

160225 = 400^2 + 15^2,
= 399^2 + 32^2,
= 393^2 + 76^2,
= 392^2 + 81^2,
= 384^2 + 113^2,
= 375^2 + 140^2,
= 360^2 + 175^2,
= 356^2 + 183^2,
= 337^2 + 216^2,
= 329^2 + 228^2,
= 311^2 + 252^2,
= 300^2 + 265^2.

If you *do* consider 8^2 + 1^2 = 65 = 1^2 + 8^2 to be different, then
you want such an n with 12 divisors, and the smallest one seems to be
5525 = 5^2*13*17, with (2+1)*(1+1)*(1+1) = 3*2*2 = 12 divisors.

5525 = 74^2 + 7^2,
= 73^2 + 14^2,
= 71^2 + 22^2,
= 70^2 + 25^2,
= 62^2 + 41^2,
= 55^2 + 50^2,
= 50^2 + 55^2,
= 41^2 + 62^2,
= 25^2 + 70^2,
= 22^2 + 71^2,
= 14^2 + 73^2,
= 7^2 + 74^2.

If order doesn't matter, but signs do, then the answer is
325 = 5^2*13,

325 = 18^2 + 1^2,
= 18^2 + (-1)^2,
= 17^2 + 6^2,
= 17^2 + (-6)^2,
= 15^2 + 10^2,
= 15^2 + (-10)^2,
= (-15)^2 + 10^2,
= (-15)^2 + (-10)^2,
= (-17)^2 + 6^2,
= (-17)^2 + (-6)^2,
= (-18)^2 + 1^2,
= (-18)^2 + (-1)^2.

If both order and signs matter, then the answer is 25 = 5^2.

25 = 5^2 + 0^2,
= 4^2 + 3^2,
= 4^2 + (-3)^2,
= 3^2 + 4^2,
= 3^2 + (-4)^2,
= 0^2 + 5^2,
= 0^2 + (-5)^2,
= (-3)^2 + 4^2,
= (-3)^2 + (-4)^2,
= (-4)^2 + 3^2,
= (-4)^2 + (-3)^2,
= (-5)^2 + 0^2.

-Doctor Rob, The Math Forum
Check out our web site!  http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search