Sub topic 8
Perfect Squares and the Odd Number of Factors
This chapter assumes you can write a prime factorization such as 360 = 2³ × 3² × 5 and that you know the formula for counting positive divisors: multiply (exponent + 1) over all primes. Both come from earlier chapters. Here they combine into one of the most useful shortcuts for GRE integer questions.
What a perfect square is
A perfect square is an integer that equals k² for some integer k. The perfect squares from 0 are 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, and so on.
Some edge cases matter on the GRE:
- 0 is a perfect square (0 = 0²), and 1 is a perfect square (1 = 1²).
- Negative integers are never perfect squares, because k² is never negative for an integer k.
- A decimal such as 2.25 equals 1.5², but it is not a perfect square of an integer. When a question says "perfect square," assume the integer meaning unless the problem says otherwise.
The prime-factorization test
If n = k², then every prime in k's factorization appears in n with its exponent doubled. For example, k = 12 = 2² × 3 gives k² = 144 = 2⁴ × 3². So every exponent in a perfect square is even.
The converse is also true. If every exponent in n's factorization is even, you can halve each exponent to build k.
| n | Prime factorization | Exponents | Perfect square? |
|---|---|---|---|
| 144 | 2⁴ × 3² | 4, 2 | Yes, 12² |
| 360 | 2³ × 3² × 5 | 3, 2, 1 | No |
| 900 | 2² × 3² × 5² | 2, 2, 2 | Yes, 30² |
| 72 | 2³ × 3² | 3, 2 | No |
This test explains several rules that appear often:
- A product of two perfect squares is a perfect square. The exponents of each are even, and adding even numbers gives an even number.
- A sum or difference of two perfect squares is usually not a perfect square. For example, 9 + 16 = 25 is a square, but 9 + 4 = 13 is not.
- If n² is divisible by a prime p, then n is divisible by p. The exponent of p in n² is twice its exponent in n, so a positive exponent in n² forces a positive exponent in n.
Why squares have an odd number of factors
Divisor counting gives the algebraic reason. The count of positive divisors is (e₁ + 1)(e₂ + 1)…(eₖ + 1). A product is odd only when every factor is odd. Each (eᵢ + 1) is odd exactly when eᵢ is even. So the divisor count is odd exactly when every exponent is even, which means exactly when n is a perfect square.
There is also a pairing reason. Positive divisors of n come in pairs (d, n/d) whose product is n. Take n = 36:
- 1 pairs with 36.
- 2 pairs with 18.
- 3 pairs with 12.
- 4 pairs with 9.
- 6 pairs with 6.
Every divisor has a different partner, except when d = n/d, which means d² = n. That happens only when n is a perfect square, and then √n pairs with itself. This unpaired divisor makes the total odd. For a non-square, every divisor has a different partner, so the total is even.
You can verify the claim by brute force for small numbers.
def divisor_count(n):
count = 0
for d in range(1, n + 1):
if n % d == 0:
count += 1
return count
odd_count = [n for n in range(1, 101) if divisor_count(n) % 2 == 1]
print(odd_count)
# [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]The output is exactly the perfect squares from 1 to 100.
Special cases for 0 and 1
The odd-count rule applies to positive integers. The number 1 has exactly one positive divisor, which is odd, and 1 is a perfect square, so it fits. The number 0 does not fit. Every positive integer divides 0, so 0 has infinitely many divisors. The GRE avoids this by asking about positive integers.
Counting factors of the form p²
A positive integer with exactly 3 positive factors must be p², where p is prime. The formula requires (e₁ + 1)(e₂ + 1)… = 3, and 3 is prime, so there is a single exponent e = 2. For example, 49 has factors 1, 7, 49.
Other divisor counts give other shapes. These are worth memorizing:
| Number of positive factors | Possible forms of n |
|---|---|
| 1 | 1 |
| 2 | p |
| 3 | p² |
| 4 | p³ or p × q |
| 5 | p⁴ |
| 9 | p⁸ or p² × q² |
Making a number a perfect square
A common question asks for the smallest positive integer by which to multiply n so that the result is a perfect square. Factor n, find each prime with an odd exponent, and multiply by one more copy of each such prime.
For 360 = 2³ × 3² × 5¹, the primes 2 and 5 have odd exponents. Multiply by 2 × 5 = 10:
360 × 10 = 3600 = 2⁴ × 3² × 5² = 60².
To make n a perfect square by division instead, divide by the same product of odd-exponent primes. For 360, the quotient 36 = 6² is a perfect square.
def smallest_square_multiplier(n):
multiplier = 1
p = 2
while p * p <= n:
exponent = 0
while n % p == 0:
n //= p
exponent += 1
if exponent % 2 == 1:
multiplier *= p
p += 1
if n > 1: # a leftover prime has exponent 1
multiplier *= n
return multiplier
print(smallest_square_multiplier(360)) # 10
print(smallest_square_multiplier(72)) # 2
print(smallest_square_multiplier(144)) # 1Other properties of squares
These facts help you rule out answers quickly.
- A perfect square ends in 0, 1, 4, 5, 6, or 9. It never ends in 2, 3, 7, or 8.
- When you divide a perfect square by 4, the remainder is 0 or 1, never 2 or 3. When you divide by 3, the remainder is 0 or 1, never 2.
- The square of an even integer is even, and the square of an odd integer is odd.
- Consecutive squares n² and (n + 1)² differ by 2n + 1, which is always odd.
The remainder facts follow from the remainder rules in the earlier chapter. An integer is 0, 1, 2, or 3 more than a multiple of 4, so its square leaves remainder 0, 1, 4, or 9 modulo 4, which reduce to 0, 1, 0, 1.
GRE patterns
Counting problem. "How many positive integers less than 100 have an odd number of positive factors?" These are the perfect squares 1, 4, 9, …, 81. Since 9² = 81 and 10² = 100 is not less than 100, there are 9 of them.
Quantitative comparison. Suppose n is a positive integer and n has exactly 3 positive factors. Quantity A is the number of positive factors of n², and Quantity B is 5. Since n = p², n² = p⁴ has 4 + 1 = 5 factors, so the quantities are equal.
Square roots. If n = 2⁶ × 3⁴ × 7², then √n = 2³ × 3² × 7 = 504. You halve the exponents without computing n.
Strategy. When a question mentions an "odd number of factors," "exactly three factors," or "n² is divisible by...," move straight to the prime factorization and look at the exponents.
Common errors
- Counting a repeated pair twice. For 36, the factor 6 appears once, not twice. The list is 1, 2, 3, 4, 6, 9, 12, 18, 36, which has 9 entries.
- Assuming the number of factors is odd because n is odd. The number 15 is odd but has 4 factors.
- Treating 0 as having an odd factor count. Its divisors are unbounded.
- Concluding that n is a perfect square from the divisor count alone, without checking that the count is for positive divisors. Counting negative divisors doubles the total, which is always even.
Exercise
How many positive integers n less than 200 have exactly 3 positive factors?
Show answer
Such n must equal p² for a prime p. Since p² < 200, p < 14.14, so p is one of 2, 3, 5, 7, 11, 13. That gives 4, 9, 25, 49, 121, 169, so there are 6 such integers.
Exercise
What is the smallest positive integer m such that 252m is a perfect square, and what is that perfect square?
Show answer
Factor 252 = 2² × 3² × 7. Only 7 has an odd exponent, so m = 7. Then 252 × 7 = 1764 = 2² × 3² × 7² = 42², so the perfect square is 1764.
Exercise
Does 2⁴ × 3³ × 5² have an odd or an even number of positive factors? Give the count.
Show answer
The exponent 3 is odd, so the number is not a perfect square and the count is even. The count is (4 + 1)(3 + 1)(2 + 1) = 5 × 4 × 3 = 60.