Sum of squares function


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 square roots are counted as different, and is denoted by.

Definition

The function is defined as
where |.| denotes the cardinality of the set. In other words, is the number of ways can be written as a sum of squares.
For example,, since, where every sum has 2 sign combinations, and also, since with 4 sign combinations. On the other hand is, because there exists no way to represent 3 as a sum of two squares.

The first 30 values for r_k(n), \; k=1, \dots, 8

Particular cases

The number of ways to write a natural number as sum of two squares is given by. It is given explicitly by
where is the number of divisors of which are congruent with 1 modulo 4 and is the number of divisors of which are congruent with 3 modulo 4. Using sums, the expression can be written as:
The prime factorization, where are the prime factors of the form and are the prime factors of the form gives another formula
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.
Jacobi also found an explicit formula for the case :
The generating function of the sequence for fixed can be expressed in terms of the Jacobi theta function:
where