Sub topic 7
Counting the Factors of an Integer
Prerequisite and key idea
Assume you can write a number as a prime factorization, such as \(360=2^3\cdot3^2\cdot5^1\). A factor, or positive divisor, is a positive integer that divides the number evenly.
To count the positive factors, use the rule:
\[ \text{Number of positive factors}=(a1+1)(a2+1)\cdots(a_k+1) \]
when
\[ n=p1^{a1}p2^{a2}\cdots pk^{ak} \]
is the prime factorization of \(n\).
Why the rule works
Every positive factor of \(n\) chooses an exponent for each prime. For \(n=2^3\cdot3^2\cdot5^1\):
- The exponent of 2 can be 0, 1, 2, or 3: 4 choices.
- The exponent of 3 can be 0, 1, or 2: 3 choices.
- The exponent of 5 can be 0 or 1: 2 choices.
Each choice produces one factor. Therefore,
\[ (3+1)(2+1)(1+1)=4\cdot3\cdot2=24. \]
The choice of exponent 0 means that a prime is left out. The choice of the largest exponent gives the full contribution of that prime.
from math import prod
exponents = [3, 2, 1] # 360 = 2^3 * 3^2 * 5^1
print(prod(e + 1 for e in exponents)) # 24Worked examples
For \(72=2^3\cdot3^2\), the number of positive factors is
\[ (3+1)(2+1)=12. \]
For \(1000=2^3\cdot5^3\), it is
\[ (3+1)(3+1)=16. \]
The prime factorization must include only distinct primes once each. Do not write \(2^2\cdot2^3\) as separate entries. Combine them as \(2^5\), then use \(5+1\).
| Prime factorization | Factor count |
|---|---|
| \(2^4\cdot3^1\) | \((4+1)(1+1)=10\) |
| \(5^2\cdot7^3\) | \((2+1)(3+1)=12\) |
| \(2^2\cdot3^1\cdot11^1\) | \((2+1)(1+1)(1+1)=12\) |
Common errors and GRE shortcuts
The formula counts positive factors. If a question asks for all integer factors, each positive factor usually has a corresponding negative factor, so the count doubles. Zero is never a factor of a nonzero integer because division by zero is undefined.
A number has an odd number of positive factors exactly when it is a perfect square. Factors normally pair as \(d\) and \(n/d\). In a perfect square, the square root pairs with itself, leaving one unpaired factor.
Exercise
How many positive factors does 540 have?
Show answer
Since 540 = 2^2 × 3^3 × 5, the count is (2 + 1)(3 + 1)(1 + 1) = 24.
Exercise
If n = 2^a × 3^2 has exactly 12 positive factors, what is a?
Show answer
(a + 1)(2 + 1) = 12, so a + 1 = 4 and a = 3.