perfect square <=> odd number of factors
Proof: For every divisor d of n, n/d is another, different, divisor. This gives a pairing of all the divisors. The only exception is if n/d = d.
The exceptional case n/d=d only happens when n=d^2, i.e. when n is a perfect square.
Thus, when n is not a perfect square, there is a pairing of all its divisors, hence the number of divisors is even.
If n is a perfect square, the pairing pairs up all the divisors except for sqrt(n). Thus the number of divisors is odd.