Kurt Foster on Tue, 05 Dec 2023 18:41:41 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: number of ways of writing a nonnegative integer n as a sum of 3 squares (zero being allowed).


On Dec 4, 2023, at 1:03 AM, Thomas D. Dean wrote:
If I consider each of a,b,c to be distinct even though the are not numberically:
N [a,b,c]
0 [0,0,0] -> 6 OEIS says 1 What about ordered tripes?
1 [0,0,1] -> 6 OEIS says 6 OK
2 [0,1,1] -> 6 OEIS says 12 - How do they get this?
3 [1,1,1] -> 6 OEIS says 8 - ?
4 [0,0,2] -> 6 OEIS says 6 OK
5 [0,1,2] -> 6 OEIS says 24??
6 [1,1,2] -> 6 OEIS says 24??
7 none
8 [0,2,2] -> 6 OEIS says 12
...
25 [0,0,5] [0,3,4] -> 12 OEIS says 30?
26 [0,1,5] [1,3,4] -> 12 OEIS says 72?

What am I missing? Can someone explain this to me?

The "standard" count is of the number of triples (a, b, c) with a, b, and c integers for which a^2 + b^2 + c^2 = N. Consider these as points on the sphere x^2 + y^2 + z^2 = N.

What you're missing is minus signs. If none of a, b, or c is 0, there are 8 ways to choose the signs. If one of them is 0, there are 4 ways. If two of them are 0, there are 2 ways.

So if 0 < a < b < c, , N = a^2 + b^2 + c^2, the triple (a, b, c) determines 8*3! = 8*6 = 48 points on x^2 + y^2 + z^2 = N. If 0 = a < b< c, they determine 4*3! = 24 points.

Thus for N = 26, (0, 1, 5) determines 24 points and (1, 3, 4) determines 48 points. And 24 + 48 = 72.

The other cases (e.g. 0 < a < b = c, etc) are left as exercises.