Maths WorkshopMaths problems with full solutions
Exercise 752Number theory › Divisibility and gcdL1Added 2 Nov 2026

When is the number of divisors odd?

#divisors#perfect squares#counting

Statement

Show that a positive integer nn has an odd number of positive divisors if and only if nn is a perfect square.

Hint

Pair each divisor dd with n/dn/d. The pairing is perfect except when d=n/dd=n/d.

Show solutionHide solution

Solution

Pairing. For each divisor dd of nn, n/dn/d is also a divisor. The map d↦n/dd\mapsto n/d is an involution. Fixed points satisfy d=n/dd=n/d, i.e. d2=nd^2=n.

Conclusion. If nn is not a square, all divisors pair up, so the number of divisors is even. If n=k2n=k^2, all divisors pair up except d=kd=k, so the number of divisors is odd.