In number theory, the sum of squares function is an arithmetic function that gives the number of representations for a given positive integer as the sum of squares, where representations that differ only in the order of the summands or in the signs of the numbers being squared are counted as different. It is denoted by .
The function is defined as
rk(n)=|\{(a1,a2,\ldots,ak)\inZk : n=
2 | |
a | |
1 |
+
2 | |
a | |
2 |
+ … +
2\}| | |
a | |
k |
where
| |
For example,
r2(1)=4
1=02+(\pm1)2=(\pm1)2+02
r2(2)=4
2=(\pm1)2+(\pm1)2
r2(3)=0
See main article: Sum of two squares theorem. The number of ways to write a natural number as sum of two squares is given by . It is given explicitly by
r2(n)=4(d1(n)-d3(n))
where is the number of divisors of which are congruent to 1 modulo 4 and is the number of divisors of which are congruent to 3 modulo 4. Using sums, the expression can be written as:
r2(n)=4\sumd(-1)(d-1)/2
n=2g
f1 | |
p | |
1 |
f2 | |
p | |
2 |
…
h1 | |
q | |
1 |
h2 | |
q | |
2 |
…
pi
pi\equiv1\pmod4,
qi
qi\equiv3\pmod4
r2(n)=4(f1+1)(f2+1) …
h1,h2, …
hi
r2(n)=0
See also: Legendre's three-square theorem. Gauss proved that for a squarefree number,
r3(n)=\begin{cases} 24h(-n),&ifn\equiv3\pmod{8},\\ 0&ifn\equiv7\pmod{8},\\ 12h(-4n)&otherwise, \end{cases}
There exist extensions of Gauss' formula to arbitrary integer .[1] [2]
See main article: Jacobi's four-square theorem. The number of ways to represent as the sum of four squares was due to Carl Gustav Jakob Jacobi and it is eight times the sum of all its divisors which are not divisible by 4, i.e.
r4(n)=8\sumd\midn, 4\nmiddd.
Representing, where m is an odd integer, one can express
r4(n)
r4(n)=8\sigma(2min\{k,1\
The number of ways to represent as the sum of six squares is given by
r6(n)=4\sumd\midd2(4\left(\tfrac{-4}{n/d}\right)-\left(\tfrac{-4}{d}\right)),
\left(\tfrac{ ⋅ }{ ⋅ }\right)
Jacobi also found an explicit formula for the case :[3]
r8(n)=16\sumd\midn(-1)n+dd3.
rk(n)
\vartheta(0;q)k=
k(q) | |
\vartheta | |
3 |
=
infty | |
\sum | |
n=0 |
n, | |
r | |
k(n)q |
where
\vartheta(0;q)=
infty | |
\sum | |
n=-infty |
n2 | |
q |
=1+2q+2q4+2q9+2q16+ … .
The first 30 values for
rk(n), k=1,...,8
n | = | r1(n) | r2(n) | r3(n) | r4(n) | r5(n) | r6(n) | r7(n) | r8(n) | ||
---|---|---|---|---|---|---|---|---|---|---|---|
0 | style='text-align:center;' | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |
1 | style='text-align:center;' | 1 | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | |
2 | style='text-align:center;' | 2 | 0 | 4 | 12 | 24 | 40 | 60 | 84 | 112 | |
3 | style='text-align:center;' | 3 | 0 | 0 | 8 | 32 | 80 | 160 | 280 | 448 | |
4 | style='text-align:center;' | 22 | 2 | 4 | 6 | 24 | 90 | 252 | 574 | 1136 | |
5 | style='text-align:center;' | 5 | 0 | 8 | 24 | 48 | 112 | 312 | 840 | 2016 | |
6 | style='text-align:center;' | 2×3 | 0 | 0 | 24 | 96 | 240 | 544 | 1288 | 3136 | |
7 | style='text-align:center;' | 7 | 0 | 0 | 0 | 64 | 320 | 960 | 2368 | 5504 | |
8 | style='text-align:center;' | 23 | 0 | 4 | 12 | 24 | 200 | 1020 | 3444 | 9328 | |
9 | style='text-align:center;' | 32 | 2 | 4 | 30 | 104 | 250 | 876 | 3542 | 12112 | |
10 | style='text-align:center;' | 2×5 | 0 | 8 | 24 | 144 | 560 | 1560 | 4424 | 14112 | |
11 | style='text-align:center;' | 11 | 0 | 0 | 24 | 96 | 560 | 2400 | 7560 | 21312 | |
12 | style='text-align:center;' | 22×3 | 0 | 0 | 8 | 96 | 400 | 2080 | 9240 | 31808 | |
13 | style='text-align:center;' | 13 | 0 | 8 | 24 | 112 | 560 | 2040 | 8456 | 35168 | |
14 | style='text-align:center;' | 2×7 | 0 | 0 | 48 | 192 | 800 | 3264 | 11088 | 38528 | |
15 | style='text-align:center;' | 3×5 | 0 | 0 | 0 | 192 | 960 | 4160 | 16576 | 56448 | |
16 | style='text-align:center;' | 24 | 2 | 4 | 6 | 24 | 730 | 4092 | 18494 | 74864 | |
17 | style='text-align:center;' | 17 | 0 | 8 | 48 | 144 | 480 | 3480 | 17808 | 78624 | |
18 | style='text-align:center;' | 2×32 | 0 | 4 | 36 | 312 | 1240 | 4380 | 19740 | 84784 | |
19 | style='text-align:center;' | 19 | 0 | 0 | 24 | 160 | 1520 | 7200 | 27720 | 109760 | |
20 | style='text-align:center;' | 22×5 | 0 | 8 | 24 | 144 | 752 | 6552 | 34440 | 143136 | |
21 | style='text-align:center;' | 3×7 | 0 | 0 | 48 | 256 | 1120 | 4608 | 29456 | 154112 | |
22 | style='text-align:center;' | 2×11 | 0 | 0 | 24 | 288 | 1840 | 8160 | 31304 | 149184 | |
23 | style='text-align:center;' | 23 | 0 | 0 | 0 | 192 | 1600 | 10560 | 49728 | 194688 | |
24 | style='text-align:center;' | 23×3 | 0 | 0 | 24 | 96 | 1200 | 8224 | 52808 | 261184 | |
25 | style='text-align:center;' | 52 | 2 | 12 | 30 | 248 | 1210 | 7812 | 43414 | 252016 | |
26 | style='text-align:center;' | 2×13 | 0 | 8 | 72 | 336 | 2000 | 10200 | 52248 | 246176 | |
27 | style='text-align:center;' | 33 | 0 | 0 | 32 | 320 | 2240 | 13120 | 68320 | 327040 | |
28 | style='text-align:center;' | 22×7 | 0 | 0 | 0 | 192 | 1600 | 12480 | 74048 | 390784 | |
29 | style='text-align:center;' | 29 | 0 | 8 | 72 | 240 | 1680 | 10104 | 68376 | 390240 | |
30 | style='text-align:center;' | 2×3×5 | 0 | 0 | 48 | 576 | 2720 | 14144 | 71120 | 395136 |