In mathematics, and specifically in number theory, a divisor function is an arithmetical function related to the divisors of an integer. When referred to as the divisor function, it counts the number of divisors of an integer. It appears in a number of remarkable identities, including relationships on the Riemann zeta function and the Eisenstein series of modular forms. Divisor functions were studied by Ramanujan, who gave a number of important congruences and identities.
A related function is the divisor summatory function, which, as the name implies, is a sum over the divisor function.
Contents 
The sum of positive divisors function σ_{x}(n), for a real or complex number x, is defined as the sum of the x^{th} powers of the positive divisors of n, or
The notations d(n) and τ(n) (for the German Teiler = divisors) are also used to denote σ_{0}(n), or the number of divisors of n (sequence A000005 in OEIS). When x is 1, the function is called the sigma function or sumofdivisors function, and the subscript is often omitted, so σ(n) is equivalent to σ_{1}(n) (sequence A000203 in OEIS). The aliquot sum s(n) of n is the sum of the proper divisors (that is, the divisors excluding n itself (sequence A001065 in OEIS)), and equals σ_{1}(n) − n; the aliquot sequence of n is formed by repeatedly applying the aliquot sum function.
For example, σ_{0}(12) is the number of the divisors of 12:
while σ_{1}(12) is the sum of all the divisors:
and the aliquot sum s(12) of proper divisors is:
n  Divisors  σ_{0}(n)  σ_{1}(n)  s(n) = σ_{1}(n) − n  Comment 

1  1  1  1  0  square number: σ_{0}(n) is odd; power of 2: s(n) = n − 1 (almostperfect) 
2  1,2  2  3  1  
3  1,3  2  4  1  
4  1,2,4  3  7  3  square number: σ_{0}(n) is odd; power of 2: s(n) = n − 1 (almostperfect) 
5  1,5  2  6  1  
6  1,2,3,6  4  12  6  first perfect number: s(n) = n 
7  1,7  2  8  1  
8  1,2,4,8  4  15  7  power of 2: s(n)=n1 (almostperfect) 
9  1,3,9  3  13  4  square number: σ_{0}(n) is odd 
10  1,2,5,10  4  18  8  
11  1,11  2  12  1  
12  1,2,3,4,6,12  6  28  16  first abundant number: s(n) > n 
13  1,13  2  14  1  
14  1,2,7,14  4  24  10  
15  1,3,5,15  4  24  9  
16  1,2,4,8,16  5  31  15  square number: σ_{0}(n) is odd; power of 2: s(n) = n − 1 (almostperfect) 
For a nonsquare integer every divisor d of n is paired with divisor n/d of n and σ_{0}(n) is then even; for a square integer one divisor (namely ) is not paired with a distinct divisor and σ_{0}(n) is then odd.
For a prime number p,
because by definition, the factors of a prime number are 1 and itself. Also
where p_{n}# denotes the primorial.
Clearly, 1 < d(n) < n and σ(n) > n for all n > 2.
The divisor function is multiplicative, but not completely multiplicative. The consequence of this is that, if we write
where r = ω(n) is the number of distinct prime factors of n, p_{i} is the ith prime factor, and a_{i} is the maximum power of p_{i} by which n is divisible, then we have
which is equivalent to the useful formula:
It follows (by setting x = 0) that d(n) is:
For example, if n is 24, there are two prime factors (p_{1} is 2; p_{2} is 3); noting that 24 is the product of 2^{3}×3^{1}, a_{1} is 3 and a_{2} is 1. Thus we can calculate d(24) as so:
The eight divisors counted by this formula are 1, 2, 4, 8, 3, 6, 12, and 24.
We also note s(n) = σ(n) − n. Here s(n) denotes the sum of the proper divisors of n, i.e. the divisors of n excluding n itself. This function is the one used to recognize perfect numbers which are the n for which s(n) = n. If s(n) > n then n is an abundant number and if s(n) < n then n is a deficient number.
If n is a power of 2, e.g. n = 2^k, then σ(n) = 2^(k+1)  1 = 2n  1 and s(n) = n  1, which makes n almostperfect.
As an example, for two distinct primes p and q with p < q, let
Then
and
where φ(n) is Euler's totient function.
Then, the roots of:
allows us to express p and q in terms of σ(n) and φ(n) only, without even knowing n or p+q, as:
Also, knowing n and either σ(n) or φ(n) (or knowing p+q and either σ(n) or φ(n)) allows us to easily find p and q.
In 1984, Roger HeathBrown proved that
will occur infinitely often.
Two Dirichlet series involving the divisor function are:
which for d(n) = σ_{0}(n) gives
and
A Lambert series involving the divisor function is:
for arbitrary complex q ≤ 1 and a. This summation also appears as the Fourier series of the Eisenstein series and the invariants of the Weierstrass elliptic functions
In littleo notation, the divisor function satisfies the inequality (see page 296 of Apostol’s book^{[1]})
More precisely, Severin Wigert showed that
On the other hand, since there are infinitely many prime numbers,
In BigO notation, Dirichlet showed that the average order of the divisor function satisfies the following inequality (see Theorem 3.3 of Apostol’s book^{[1]})
where γ is Euler's constant. Improving the bound in this formula is known as Dirichlet's divisor problem
The behaviour of the sigma function is irregular. The asymptotic growth rate of the sigma function can be expressed by:
where lim sup is the limit superior. This result is Grönwall's theorem, published in 1913.
In 1915, Ramanujan proved that under the assumption of the Riemann hypothesis, the inequality:
holds for all sufficiently large n. In 1984 Guy Robin proved that the inequality is true for all for n ≥ 5,041 if and only if the Riemann hypothesis is true (Robin 1984). This is Robin's theorem and the inequality became known after him. The largest known value that violates the inequality is n=5,040. If the Riemann hypothesis is true, there are no greater exceptions. If the hypothesis is false, then Robin showed there are an infinite number of values of n that violate the inequality, and it is known that the smallest such n ≥ 5,041 must be superabundant (Akbary & Friggstad 2009). It has been shown that the inequality holds for large odd and squarefree integers, and that the Riemann hypothesis is equivalent to the inequality just for n divisible by the fifth power of a prime (Choie et al. 2007).
A related bound was given by Jeffrey Lagarias in 2002, who proved that the Riemann hypothesis is equivalent to the statement that
for every natural number n, where H_{n} is the nth harmonic number, (Lagarias 2002).
