Arithmetic Functions

Study Sheet

Arithmetic Functions

Counting and summing divisors, and multiplicativity

τ\tau, σ\sigma and φ\varphi

Concept
Multiplicative functions

τ(n)\tau(n) counts the divisors of nn, σ(n)\sigma(n) sums them, φ(n)\varphi(n) counts the residues coprime to nn. All three are multiplicative: f(mn)=f(m)f(n)f(mn) = f(m)f(n) when gcd⁡(m,n)=1\gcd(m, n) = 1. So each is determined by its values on prime powers: τ(pe)=e+1\tau(p^e) = e + 1, σ(pe)=pe+1−1p−1\sigma(p^e) = \dfrac{p^{e+1} - 1}{p - 1}, φ(pe)=pe−pe−1\varphi(p^e) = p^e - p^{e-1}.

Multiplicativity is the Chinese remainder theorem seen from the divisor side: a divisor of mnmn (coprime parts) is a divisor of mm times a divisor of nn, uniquely. That single bijection gives all three formulas at once. The prime-power values are direct counts: pep^e has divisors 1,p,…,pe1, p, \ldots, p^e (a geometric series for σ\sigma), and among 1,…,pe1, \ldots, p^e the pe−1p^{e-1} multiples of pp are exactly the non-coprime ones. Perfect numbers (σ(n)=2n\sigma(n) = 2n) and the famous open questions about them all live inside σ\sigma.

Example
Evaluate all three at 7272
12483612249183672× 2 across · × 3 upsum 15sum 45sum 135
The 12 divisors of 72; the rows sum to 15, 45, 135, and 15 + 45 + 135 = 195.

72=23⋅3272 = 2^3\cdot3^2, and 232^3, 323^2 are coprime, so each function is a product of two prime-power values. τ=(3+1)(2+1)=12\tau = (3 + 1)(2 + 1) = 12. σ=(1+2+4+8)(1+3+9)=15⋅13=195\sigma = (1 + 2 + 4 + 8)(1 + 3 + 9) = 15\cdot13 = 195 — in the grid, each row sums to 1515 times its power of 33. φ=(8−4)(9−3)=24\varphi = (8 - 4)(9 - 3) = 24.

Example
A perfect number

Show 496496 is perfect. 496=16⋅31=24⋅31496 = 16\cdot31 = 2^4\cdot31 with 3131 prime. So σ(496)=σ(24)σ(31)=31⋅32=992=2⋅496\sigma(496) = \sigma(2^4)\sigma(31) = 31\cdot32 = 992 = 2\cdot496. The divisors other than 496496 itself sum to 496496. Every even perfect number has this shape, 2k−1(2k−1)2^{k-1}(2^k - 1) with 2k−12^k - 1 prime (Euclid and Euler).

Example
When is φ(n)=n/3\varphi(n) = n/3?

Since φ(n)/n=∏p∣n(1−1/p)\varphi(n)/n = \prod_{p \mid n}(1 - 1/p) depends only on WHICH primes divide nn, look for prime sets with ∏(p−1)/p=1/3\prod(p - 1)/p = 1/3, i.e. 3∏(p−1)=∏p3\prod(p - 1) = \prod p. The right side must be a multiple of 33, so 33 is in the set; cancelling it leaves 2∏rest(p−1)=∏restp2\prod_{\text{rest}}(p - 1) = \prod_{\text{rest}} p, so 22 is in too, and then ∏(p−1)=∏p\prod(p-1) = \prod p over the remaining primes forces there to be none. So φ(n)=n/3\varphi(n) = n/3 exactly when n=2a3bn = 2^a3^b with a,b≥1a, b \ge 1 — e.g. φ(12)=4\varphi(12) = 4.

Side note
Where it goes wrong

Multiplying across factors that are not coprime. τ(4)=3\tau(4) = 3, but τ(2)τ(2)=4\tau(2)\tau(2) = 4: the "divisor of 22 times divisor of 22" products 1⋅21\cdot2 and 2⋅12\cdot1 are the same divisor of 44. Always split nn into prime powers first.

Try it
Try it: from the formulas

Find τ(1000)\tau(1000), σ(1000)\sigma(1000) and φ(1000)\varphi(1000).

Show the answer

1000=23⋅531000 = 2^3\cdot5^3: τ=4⋅4=16\tau = 4\cdot4 = \mathbf{16}; σ=(1+2+4+8)(1+5+25+125)=15⋅156=2340\sigma = (1+2+4+8)(1+5+25+125) = 15\cdot156 = \mathbf{2340}; φ=(8−4)(125−25)=4⋅100=400\varphi = (8-4)(125-25) = 4\cdot100 = \mathbf{400}.

Sums and Products over Divisors

Concept
Summing over d∣nd \mid n

Many identities sum a function over the divisors of nn. Two to know: ∑d∣nφ(d)=n\sum_{d \mid n}\varphi(d) = n, and the product of all divisors of nn is nτ(n)/2n^{\tau(n)/2}. For multiplicative ff, the divisor sum ∑d∣nf(d)\sum_{d \mid n} f(d) is again multiplicative — which is exactly why σ\sigma and τ\tau are.

Both identities come from organizing the divisors cleverly. For the product, pair each dd with n/dn/d: every pair multiplies to nn, and there are τ(n)/2\tau(n)/2 pairs (a square has a middle divisor paired with itself, which the exponent τ/2\tau/2 handles). For the φ\varphi identity, write the fractions k/nk/n for k=1,…,nk = 1, \ldots, n in lowest terms and sort them by denominator: exactly φ(d)\varphi(d) of them have denominator dd.

Example
∑d∣12φ(d)=12\sum_{d \mid 12}\varphi(d) = 12
d = 11/11d = 21/21d = 31/32/32d = 41/43/42d = 61/65/62d = 121/125/127/1211/1241 + 1 + 2 + 2 + 2 + 4 = 12
The twelve fractions k/12 in lowest terms, sorted by denominator: φ(d) in each column.

The fractions 112,212,…,1212\tfrac1{12}, \tfrac2{12}, \ldots, \tfrac{12}{12} reduce to fractions whose denominators divide 1212. A reduced fraction kd\tfrac kd with 1≤k≤d1 \le k \le d has gcd⁡(k,d)=1\gcd(k, d) = 1, so exactly φ(d)\varphi(d) of them have denominator dd. Column by column: φ(1)+φ(2)+φ(3)+φ(4)+φ(6)+φ(12)=1+1+2+2+2+4=12\varphi(1) + \varphi(2) + \varphi(3) + \varphi(4) + \varphi(6) + \varphi(12) = 1 + 1 + 2 + 2 + 2 + 4 = 12.

Example
σ(12)\sigma(12) two ways

List: the divisors of 1212 are 1,2,3,4,6,121, 2, 3, 4, 6, 12, sum 2828. Factor: σ(12)=σ(4)σ(3)=(1+2+4)(1+3)=7⋅4=28\sigma(12) = \sigma(4)\sigma(3) = (1 + 2 + 4)(1 + 3) = 7\cdot4 = 28. Expanding (1+2+4)(1+3)(1 + 2 + 4)(1 + 3) produces each product 2i3j2^i3^j exactly once — which is each divisor exactly once. That is the whole proof of multiplicativity in one line.

Example
The product of the divisors of 7272

τ(72)=12\tau(72) = 12. Pair each divisor dd with 72/d72/d: 1⋅721\cdot72, 2⋅362\cdot36, 3⋅243\cdot24, 4⋅184\cdot18, 6⋅126\cdot12, 8⋅98\cdot9 — six pairs, each with product 7272. So the product of all divisors is 72672^6, in agreement with nτ(n)/2=7212/2n^{\tau(n)/2} = 72^{12/2}.

Side note
Where it goes wrong

Guessing a prime-power formula by pattern. φ(pe)=(p−1)e\varphi(p^e) = (p - 1)^e looks natural and is wrong: φ(8)=4\varphi(8) = 4 (the odd numbers 1,3,5,71, 3, 5, 7), while (2−1)3=1(2 - 1)^3 = 1. The correct count removes the pe−1p^{e-1} multiples of pp: φ(8)=8−4\varphi(8) = 8 - 4.

Try it
Try it: a product of divisors

Find the product of all positive divisors of 3636.

Show the answer

36=22⋅3236 = 2^2\cdot3^2 has τ=9\tau = 9 divisors. They pair as 1⋅36,2⋅18,3⋅12,4⋅91\cdot36, 2\cdot18, 3\cdot12, 4\cdot9, with 66 left over as its own partner. Product =364⋅6=369/2=69=10077696= 36^4\cdot6 = 36^{9/2} = 6^9 = \mathbf{10077696}.

Divisor Problems

Concept
Reading off structure

Questions like "which nn have exactly 66 divisors?" are questions about exponent patterns: 6=66 = 6 or 2⋅32\cdot3, so n=p5n = p^5 or n=p2qn = p^2q. "Perfect squares have an odd number of divisors" is τ(n)\tau(n) odd iff every ei+1e_i + 1 is odd.

Because τ(n)=∏(ei+1)\tau(n) = \prod(e_i + 1), a target divisor count factors into the "+1+1" pieces, and each factorization of the count is one exponent pattern. To minimize nn for a pattern, put the largest exponent on 22, the next on 33, and so on. Parity questions go through pairing: divisors come in pairs d,n/dd, n/d unless d=n/dd = n/d, which happens only when nn is a square.

Example
Smallest with 1212 divisors

Factor the count: 12=12=6⋅2=4⋅3=3⋅2⋅212 = 12 = 6\cdot2 = 4\cdot3 = 3\cdot2\cdot2, so the exponent patterns are (11)(11), (5,1)(5, 1), (3,2)(3, 2), (2,1,1)(2, 1, 1). Put the biggest exponent on the smallest prime: 211=20482^{11} = 2048, 25⋅3=962^5\cdot3 = 96, 23⋅32=722^3\cdot3^2 = 72, 22⋅3⋅5=602^2\cdot3\cdot5 = 60. The smallest is 6060.

Example
An odd number of divisors
1234691218364 pairs and 6 alone: 9 divisors, an odd number
Divisors of 36 pair up as d and 36/d, except 6, which pairs with itself.

Which n≤100n \le 100 have an odd number of divisors? Pair each divisor dd with n/dn/d. The pairs account for an even number of divisors, and a divisor is unpaired only when d=n/dd = n/d, i.e. d2=nd^2 = n. So τ(n)\tau(n) is odd exactly when nn is a perfect square: 1,4,9,…,1001, 4, 9, \ldots, 100, ten numbers. (The classic "lockers" puzzle is this fact in disguise.)

Example
Exactly three divisors

How many n≤1000n \le 1000 have exactly 33 divisors? 33 is prime, so the only pattern is e+1=3e + 1 = 3: n=p2n = p^2. Need p2≤1000p^2 \le 1000, i.e. p≤31p \le 31 (as 312=96131^2 = 961 and 372>100037^2 > 1000). The primes 2,3,5,7,11,13,17,19,23,29,312, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 give 1111 such nn.

Side note
Where it goes wrong

Assigning the larger exponents to the larger primes. For 1212 divisors with pattern (3,2)(3, 2), 22⋅33=1082^2\cdot3^3 = 108 is bigger than 23⋅32=722^3\cdot3^2 = 72. To minimize nn for a given τ\tau, the biggest exponent goes on the smallest prime.

Try it
Try it: exactly 1010 divisors

What is the smallest positive integer with exactly 1010 divisors?

Show the answer

10=1010 = 10 or 5⋅25\cdot2, so n=p9n = p^9 or n=p4qn = p^4q. The smallest of each: 29=5122^9 = 512 and 24⋅3=482^4\cdot3 = 48. Answer 48.

Why It Works

Let gcd⁡(m,n)=1\gcd(m, n) = 1. Every divisor dd of mnmn splits uniquely as d=d1d2d = d_1d_2 with d1=gcd⁡(d,m)d_1 = \gcd(d, m) dividing mm and d2=gcd⁡(d,n)d_2 = \gcd(d, n) dividing nn, because the primes of mm and of nn are disjoint. Conversely every product d1d2d_1d_2 of such divisors divides mnmn. So divisors of mnmn correspond one-to-one with pairs (divisor of mm, divisor of nn). Counting the pairs gives τ(mn)=τ(m)τ(n)\tau(mn) = \tau(m)\tau(n); summing d1d2d_1d_2 over the pairs gives σ(mn)=∑d1⋅∑d2=σ(m)σ(n)\sigma(mn) = \sum d_1 \cdot \sum d_2 = \sigma(m)\sigma(n). For φ\varphi, the Chinese remainder theorem supplies the matching bijection between residues coprime to mnmn and pairs of residues coprime to mm and to nn.