The Divisor Functions

Pick a number — say, a class of 12 pupils, or a $36 pizza bill to split. Two questions come up all the time: how many ways can I split this evenly, and what do all the ways add up to? In number theory this is: how many divisors does n have, and what do they sum to? Both questions have surprisingly clean answers, and both answers are multiplicative functions — meaning they fall straight out of the prime factorisation without ever having to list a single divisor by hand.

These two functions have their own names and symbols: \tau(n) (or d(n)) counts the divisors, and \sigma(n) sums them. They look like small bookkeeping tools, but as you'll see on the next page, one of them is the exact ingredient behind a 2000-year-old mystery.

A school scheduler asks a version of the first question every term: "into how many equal-sized groups can I split 24 pupils?" — that's really asking for the divisors of 24. A warehouse manager stacking 60 boxes into equal rows asks the same question in disguise. Neither of them wants to try every possible group size by hand — and neither will we.

Counting divisors: \tau(n)

Write \tau(n) for the number of positive divisors of n. Suppose n = p_1^{a_1} p_2^{a_2} \cdots p_k^{a_k} is its prime factorisation. Building a divisor means choosing, independently for each prime p_i, an exponent somewhere from 0 up to a_i — that's a_i + 1 independent choices for each prime, and the choices multiply (a basic counting rule: independent choices combine by multiplying the number of options):

\tau(n) = (a_1 + 1)(a_2 + 1)\cdots(a_k + 1).

Nothing here needs you to actually list the divisors — the exponents in the factorisation tell you everything. Watch it happen concretely for n = 12 = 2^2 \cdot 3^1: the exponent of 2 can be 0, 1, or 2 (three choices), and the exponent of 3 can be 0 or 1 (two choices). Every one of the 3 \times 2 = 6 pairings gives a different divisor — 2^0 3^0{=}1,\ 2^1 3^0{=}2,\ 2^2 3^0{=}4,\ 2^0 3^1{=}3,\ 2^1 3^1{=}6,\ 2^2 3^1{=}12 — and that list is exactly the six divisors of 12, with nothing missing and nothing repeated.

Summing divisors: \sigma(n)

Write \sigma(n) for the sum of the positive divisors (including n itself). On a single prime power the divisors are 1, p, p^2, \ldots, p^a — a geometric series with a tidy closed form:

\sigma(p^{a}) = 1 + p + p^2 + \cdots + p^{a} = \frac{p^{a+1} - 1}{p - 1}.

Because \sigma is multiplicative, the value on a general n is just the product of its values on each prime-power piece of the factorisation:

\sigma(n) = \sigma(p_1^{a_1})\,\sigma(p_2^{a_2}) \cdots \sigma(p_k^{a_k}).

The closed form for a single prime power is worth trusting rather than memorising blindly: for p = 2, a = 2 it gives \sigma(4) = \tfrac{2^3-1}{2-1} = 7, which matches 1+2+4=7 directly; for p=3, a=1 it gives \sigma(3) = \tfrac{3^2-1}{3-1} = 4, matching 1+3=4. The formula is just a shortcut for adding up a geometric series — it never disagrees with counting by hand.

Worked examples

The whole point of the formulas is that they match brute-force listing — but arrive there without the listing. Three examples, checked both ways.

Example 1: n = 12.

Direct: the divisors of 12 are 1, 2, 3, 4, 6, 12 — that's 6 of them, summing to 1+2+3+4+6+12 = 28.

By formula: 12 = 2^2 \cdot 3, so

\tau(12) = (2+1)(1+1) = 6, \qquad \sigma(12) = (1+2+4)(1+3) = 7 \cdot 4 = 28.

Both methods agree, exactly as they must.

Example 2: n = 100.

100 = 2^2 \cdot 5^2, two primes with matching exponents:

\tau(100) = (2+1)(2+1) = 9, \qquad \sigma(100) = (1+2+4)(1+5+25) = 7 \cdot 31 = 217.

Listing all nine divisors (1,2,4,5,10,20,25,50,100) and adding them by hand gives the same 217 — but the formula got there in two multiplications. Since 217 > 200 = 2 \cdot 100, 100 is abundant too — round numbers with lots of small prime factors tend to be.

Example 3: a prime, n = 13.

A prime is its own one-term factorisation, 13 = 13^1, so \tau(13) = (1+1) = 2 and \sigma(13) = 1 + 13 = 14. This is really just the definition of "prime" wearing a formula: a prime's only divisors are 1 and itself.

Seeing the pairs

Divisors always come in pairs that multiply back to n: if d divides n, so does n / d, and d \cdot (n/d) = n. Below, each divisor of n is placed on a scale where equal steps mean doubling (so multiplying two numbers means the steps simply add). On a scale like that, a pair d and n/d always sits mirrored around \sqrt{n} — the dashed line. Try a few values of n and watch the mirror hold.

For n=12 the pairs are 1{\times}12,\ 2{\times}6,\ 3{\times}4 — three pairs, six divisors total, matching \tau(12) = 6 exactly. The doubling scale is chosen on purpose: multiplying two numbers becomes adding their positions on it, so a pair that multiplies to n always lands the same total distance apart, symmetric about the midpoint \sqrt{n}. When n is a perfect square, one divisor — \sqrt{n} itself — sits exactly on the mirror line with no partner, which is precisely why perfect squares are the only numbers with an odd \tau(n).

Reading a number's character

\tau and \sigma reveal a number's "shape" at a glance. A prime has \tau(p) = 2 — the smallest possible value for anything bigger than 1, since every number has at least the two divisors 1 and itself. A perfect square has an odd \tau, because its square-root divisor is unpaired while every other divisor pairs off with a distinct partner. And comparing \sigma(n) against 2n sorts every number into one of three camps: deficient (\sigma(n) < 2n), abundant (\sigma(n) > 2n), or — vanishingly rarely — exactly balanced.

Take 12 from the worked examples above: \sigma(12) = 28 and 2 \cdot 12 = 24, and 28 > 24, so 12 is abundant — it has more "divisor weight" than its own size. Compare that with 15: its divisors 1, 3, 5, 15 sum to 24, and 24 < 30 = 2 \cdot 15, so 15 is deficient. Most numbers you meet are deficient — abundant numbers are a minority, and the exactly-balanced ones are rarer still.

The names are shorthand for exactly what the functions do. \sigma is the Greek letter sigma — the same letter used everywhere in maths for "sum" (\sum is a stretched-out sigma). \tau, tau, stands in for "total" or, in some older texts, the German Teiler ("divisor") — you'll also see it written d(n) for the same reason, plain "divisor count." Different books pick different letters, but on this page \tau always means "how many" and \sigma always means "sum of."

Multiplicativity has a coprime condition baked in: \tau(mn) = \tau(m)\tau(n) only when \gcd(m, n) = 1. Split a number into pieces that share a factor and the product rule breaks.

For instance, 8 = 2 \times 4, and it's tempting to write \tau(8) = \tau(2)\,\tau(4) = 2 \cdot 3 = 6. That's wrong8's actual divisors are 1, 2, 4, 8, so \tau(8) = 4. The mistake was splitting along 2 \times 4, and \gcd(2,4) = 2 \neq 1 — not coprime. The formula only ever wants the split along distinct primes: 8 = 2^3 is a single prime power, so the product formula gives \tau(2^3) = 3 + 1 = 4 directly — no splitting needed at all, and the right answer.

The same trap catches \sigma: splitting 8 as 2 \times 4 and computing \sigma(2)\,\sigma(4) = 3 \cdot 7 = 21 overshoots the real answer, \sigma(8) = 1+2+4+8 = 15. Whenever you're tempted to split a number to use the product rule, first check the two pieces really are coprime — or better, always split all the way down to distinct prime powers, where the rule is guaranteed to apply.

\sigma(n) can look like an abstract bit of bookkeeping — until you meet its most famous job. Two thousand years ago, the Greeks noticed that some very special numbers equal the sum of their own divisors (not counting themselves): 6 = 1 + 2 + 3. In the language of \sigma, that condition is simply \sigma(n) = 2n. Numbers like this are called perfect numbers, and they hide a puzzle mathematicians still haven't fully solved — that's next.