# Sum of positive divisors if and only if perfect square

let n be a positive odd integer, prove that the sum of the positive divisors of n is odd if and only if n is a perfect square.

I know that based on the prime factorization theory that every integer n can be written as the product of primes, if their sum is odd that means that there are equal pairs of even and odd divisors. Is this enough to conclude that n must be a perfect square?

• I'm a little surpised at the number of answers that calculat the sum as the product of the sums of the powers of the prime divisors. I think it is much simpler to realize that a number is a perfect square if and only if the has an odd number of factors. (Because every factor $k$ "pairs up" with the factor $\frac nk$ except for the odd factor $k = \sqrt{n} = \frac n{\sqrt n} = \frac nk$. – fleablood Oct 30 '17 at 23:43

Note that the sum of the positive divisors can be written

$$\sigma(n)=(1+p_1+p_1^2+...+p_1^{k_1})\ldots(1+p_r+p_r^2+...+p_r^{k_r})$$

Where $n=p_1^{k_1}p_2^{k_2}\ldots p_r^{k_r}$ is the prime factorization of $n$. Consider one of these terms, $(1+p_1+p_1^2+...+p_1^{k_1})$. When is this odd or even? You can convince yourself that the $m$th term is odd when $k_m$ is even, and vice versa. If we have even just one of these terms be even, the entire product will be even, thus they must all be odd, which implies all $k_m$ are even. That is, we can write them as $k_m=2b_m$ for some $b_m$. Thus,

$$n=p_1^{k_1}p_2^{k_2}\ldots p_r^{k_r}=p_1^{2b_1}p_2^{2b_2}\ldots p_r^{2b_r}=(p_1^{b_1}p_2^{b_2}\ldots p_r^{b_r})^2=b^2.$$

The converse proof uses the same logic.

The divisor sum of an odd number is a product of sums of the form $$1+p+p^2+\cdots +p^k$$ with an odd prime $p$ and a positive integer $k$.

This product is odd if and only if all the $k's$ are even , hence if and only if the number is a perfect square.

For any positive integer $n$, you can organize the divisors in pairs, where the product of the two numbers is $n$.

If $n$ is odd, this means that you must have a pair of divisors where both are odd (since odd times even is even and even times even is even).

From this fact, it is easy to see that, as long as you can list all of the divisors as pairs like this, then the sum of the divisors is even, since the sum of any pair of divisors must be even.

However, there is one exception: when $n$ is a perfect square, then one of the divisors of $n$ is a pair with itself. If $n=25$, then one of the pairs of divisors would be $5,5$. But when you add all of the divisors, you only count $5$ one time, and so the sum of divisors will be odd.

That is not a proof, but hopefully a convincing argument.

I don't really understand your argument: What does "there are equal pairs of even and odd divisors" mean, especially given that there are no even divisors of $n$? You really need to be precise about the objects you're considering, and careful about how it's written.

Here's an approach that you might find useful. For each $d \in \mathbb{Z}$ such that $d | n$, you can pair $d$ with $n/d$ and notice that both are odd, so that

$$2 | (d + n/d).$$

This covers all the divisors of $n$, except when something special happens....

Let $n$ have the prime factorisation $n= p_1^{\alpha_1} p_2^{\alpha_1} \cdots p_k^{\alpha_k}$ then the sum of the factors can be written as the following product \begin{eqnarray*} (1+p_1+p_1^2+\cdots+p_1^{\alpha_1})(1+p_2+p_2^2+\cdots+p_2^{\alpha_2})\cdots(1+p_k+p_k^2+\cdots+p_k^{\alpha_k}). \end{eqnarray*} Now each of these bracket will need to be odd, so each bracket will need to contain an even number of terms, thus $\alpha_i$ is even for all $i$.

"" if their sum is odd that means that there are equal pairs of even and odd divisors" "

That doesn't actually make sense.

What I think you want to say is that if the sum is odd there must be an odd number of odd terms.

(even + even = even, odd + odd = even, even + odd = odd. By induction $a_1 + a_b + ...... + a_n$ is even if and only if there is an even number of odd terms.)

Since $n$ is odd there are no even terms so all factors are odd. And...

The sum of the factors will be odd if and only if there are an odd number of factors.

So we need to prove:

Prop: If $n$ is odd, then $n$ will have an odd number of factors if and only if $n$ is a perfect square.

And, actually, that will be true whether $n$ is even or odd.

The basic idea is that for any factor $k$ then $\frac nk$ is also a factor and factors com in pairs. If any $n$ is a perfect square then $\sqrt n = \frac n{\sqrt{n}}$ is the only factor that pairs to itself.

A more thorough Proof: Let's imagine listing out all the $m$ factors of $n$ in order $k_1=1 < k_2 < ..... < k_m = n$.

Notice that if $k_i$ is a factor then $k_i' = \frac n{k_i}$ is also a factor and must also be in the list. But where is it on the list.

Well, $k_{i- 1} < k_i < k_{i+1}$ so $k_{i+1}' = \frac n{k_{i+1}} < k_{i}' = \frac n{k_{i}} < k_{i-1}' = \frac n{k_{i-1}}$

The list $k_1 < ..... < k_m$ can be rewritten as $k_m' < ..... < k_1'$ and we know $k_i' = k_{m+1-i}'$ (and with the knowledge that $k_i*k_i' = n$).

If $m$ is odd then the middle term is $k_{\frac {m+1}2} = k_{m+1 - \frac {m+1}2}' = k_{\frac {m+1}2}'$ so $k_{\frac {m+1}2}*k_{\frac {m+1}2}' = k_{\frac {m+1}2}*k_{\frac {m+1}2} = n$ and $n$ is a perfect square.

If $m$ is not odd then there is no middle term and there is no $k_i = k_i'$ , so there is no factor so that $k_i * k_i = n$. (Remember, those lists were all the factors.)

So perfect squares are the only integers with an odd number of factors and all perfect squares have an odd number of factors..