The Ultimate Guide to the Divisor Function (σₓ(n))
Welcome to the comprehensive guide on the divisor function, a fascinating and important arithmetic function in number theory. This guide, along with our versatile divisor function calculator, will explore what this function is, its different forms, and how to calculate it with step-by-step examples.
What is the Divisor Function?
The divisor function, denoted as σₓ(n), is a function that sums the x-th powers of the positive divisors of an integer 'n'. The formula is:
While this looks abstract, it gives rise to two very famous and intuitive functions by setting the exponent 'x' to specific values:
- 🔢 The Number of Divisors Function (x=0): When x=0, each term d⁰ becomes 1. So, σ₀(n) is simply the sum of 1s for each divisor, which gives you the total number of divisors of 'n'. This is often denoted as d(n) or τ(n).
- ➕ The Sum of Divisors Function (x=1): When x=1, each term d¹ is just the divisor itself. So, σ₁(n) is the sum of all the positive divisors of 'n', including 1 and n. This is often written simply as σ(n).
Our calculator can handle any value of x, but these two are the most common applications.
How to Calculate the Divisor Function
The most efficient way to calculate σₓ(n) for any 'x' is by using the number's prime factorization. This is the method our calculator uses to provide a step-by-step solution.
If the prime factorization of 'n' is n = p₁a₁ × p₂a₂ × ... × pᵣaᵣ, then the formula for σₓ(n) is:
Special Case Formulas
This general formula simplifies nicely for our two main cases:
- Number of Divisors (d(n) = σ₀(n)): Just add 1 to each exponent in the prime factorization and multiply them together.
d(n) = (a₁ + 1)(a₂ + 1)...(aᵣ + 1)
- Sum of Divisors (σ(n) = σ₁(n)): This uses the formula for the sum of a geometric series for each prime factor.
σ(n) = ( (p₁a₁+1 - 1) / (p₁ - 1) ) × ( (p₂a₂+1 - 1) / (p₂ - 1) ) × ...
Divisor Function Examples
Let's walk through an example to see how the calculator works.
Calculate the number of divisors d(120) and the sum of divisors σ(120).
- Step 1: Prime Factorization
First, find the prime factors of 120. 120 = 12 × 10 = (2² × 3) × (2 × 5) = 2³ × 3¹ × 5¹.
- Step 2: Calculate Number of Divisors (d(n) or σ₀(n))
We use the formula
d(n) = (a₁ + 1)(a₂ + 1)...
. The exponents are 3, 1, and 1.d(120) = (3 + 1)(1 + 1)(1 + 1) = 4 × 2 × 2 = 16.
So, 120 has 16 divisors. - Step 3: Calculate Sum of Divisors (σ(n) or σ₁(n))
We use the formula
σ(n) = ( (p₁a₁+1 - 1) / (p₁ - 1) ) × ...
- For p₁=2, a₁=3: (23+1 - 1) / (2 - 1) = (16 - 1) / 1 = 15
- For p₂=3, a₂=1: (31+1 - 1) / (3 - 1) = (9 - 1) / 2 = 4
- For p₃=5, a₃=1: (51+1 - 1) / (5 - 1) = (25 - 1) / 4 = 6
σ(120) = 15 × 4 × 6 = 360.
The sum of all divisors of 120 is 360.
Key Properties of the Divisor Function
- 🤝 Multiplicative Property: The divisor function is a multiplicative function. This means if 'm' and 'n' are coprime, then σₓ(mn) = σₓ(m) × σₓ(n). The divisor function multiplicative proof is a key result in number theory and follows directly from the product formula and the unique prime factorization of 'mn'.
- 🅿️ For a prime number p:
- The number of divisors is always 2 (1 and p). So, d(p) = 2.
- The sum of divisors is always p + 1. So, σ(p) = p + 1.
Divisor Function in Python
Here is an efficient implementation of a divisor function in Python that calculates both the number and sum of divisors.
def get_prime_factorization(n):
factors = {}
d = 2
temp = n
while d * d <= temp:
while temp % d == 0:
factors[d] = factors.get(d, 0) + 1
temp //= d
d += 1
if temp > 1:
factors[temp] = factors.get(temp, 0) + 1
return factors
def divisor_functions(n):
if n == 0:
return (0, 0)
if n == 1:
return (1, 1)
factors = get_prime_factorization(n)
# Number of divisors d(n)
num_divisors = 1
for p in factors:
num_divisors *= (factors[p] + 1)
# Sum of divisors sigma(n)
sum_divisors = 1
for p in factors:
sum_divisors *= (p**(factors[p] + 1) - 1) // (p - 1)
return (num_divisors, sum_divisors)
# Example
num = 120
d_n, sigma_n = divisor_functions(num)
print(f"For n = {num}:")
print(f"Number of divisors d({num}) = {d_n}")
print(f"Sum of divisors σ({num}) = {sigma_n}")
Conclusion: Unveiling the Structure of Numbers
The divisor function is a window into the multiplicative structure of integers. It provides a way to quantify the 'richness' of a number in terms of its factors. From its role in perfect numbers (where σ(n) = 2n) to its connections with other number-theoretic functions, it is a concept of enduring importance. This calculator is designed to make this function accessible and understandable, providing not just the answer, but a clear, step-by-step path to the solution.