Number Theory
Advanced

Sum of Divisors

Sum of all divisors from prime factorization.

Formula

σ(n)=∏piai+1−1pi−1\sigma(n) = \prod \frac{p_i^{a_i+1}-1}{p_i - 1}

Variables

p_iPrimes
a_iExponents

Example

Related to perfect numbers

How it works

If a positive integer n is written in prime factorized form as p_1^a_1 p_2^a_2 \cdots p_k^a_k, then every divisor of n is built by choosing an exponent for each prime between 0 and a_i. Summing all divisors therefore splits into independent geometric sums for each prime factor, which is why the total equals the product of \((p_i^{a_i+1}-1)/(p_i-1)\). This multiplicative structure comes from the fact that divisors combine by multiplying the chosen prime powers.

When to use it

Use this when you need the sum of all positive divisors of a number from its prime factorization, especially for classifying numbers like abundant, deficient, or perfect numbers. It is also useful in divisor-function problems in contest math and number theory proofs.

Worked example, step by step

Find \u03c3(84). 84 = 2^2 \cdot 3^1 \cdot 7^1 \u03c3(84) = \frac{2^{2+1}-1}{2-1} \cdot \frac{3^{1+1}-1}{3-1} \cdot \frac{7^{1+1}-1}{7-1} \u03c3(84) = \frac{8-1}{1} \cdot \frac{9-1}{2} \cdot \frac{49-1}{6} \u03c3(84) = 7 \cdot 4 \cdot 8 \u03c3(84) = 224 So the sum of all positive divisors of 84 is 224.

Common mistakes to avoid

  • Using the prime factors themselves instead of their exponents in the formula
  • Forgetting that the result includes the number n as one of its divisors
  • Adding the prime-power contributions instead of multiplying the separate geometric sums

Did You Know?

The sum-of-divisors function unlocks the ancient mystery of perfect and amicable numbers.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026