# Thread: Determining if n is a square from number of divisors?

1. ## Determining if n is a square from number of divisors?

I've noticed for a few cases that if you compute all the divisors of a composite number, if this list of divisors (including 1 and the number) is even, then the number is not a square, and if it's odd, it is a square.

But that's just for some specific examples like

divisors of 30 : {1, 2, 3, 5, 6, 10, 15, 30 } : even # of divisors, and not a square

divisors of 36: {1, 2, 3, 4, 6, 9, 12, 18, 36}: odd # of divisors, and is a square.

I'm wondering is this just a coincidence, or does this hold for all numbers? And are there any correlations between number of divisors and if the number is a cube, a quadruple, etc?

2. Good eye! Your observation is correct. This is because, if $\displaystyle n=p_1^{\alpha_1}...p_m^{\alpha_m}$ then the number of divisors of $\displaystyle n$ is $\displaystyle (\alpha_1+1)...(\alpha_m+1)$. (Can you prove it?) In the case of a square all $\displaystyle \alpha$'s are even.

You can probably answer your other question with the help of the formula above.

3. Originally Posted by Bruno J.
Good eye! Your observation is correct. This is because, if $\displaystyle n=p_1^{\alpha_1}...p_m^{\alpha_m}$ then the number of divisors of $\displaystyle n$ is $\displaystyle (\alpha_1+1)...(\alpha_m+1)$. (Can you prove it?) In the case of a square all $\displaystyle \alpha$'s are odd.

You can probably answer your other question with the help of the formula above.
In the case of a square all $\displaystyle \alpha$'s are even.

CB

4. Originally Posted by QM deFuturo
I've noticed for a few cases that if you compute all the divisors of a composite number, if this list of divisors (including 1 and the number) is even, then the number is not a square, and if it's odd, it is a square.

But that's just for some specific examples like

divisors of 30 : {1, 2, 3, 5, 6, 10, 15, 30 } : even # of divisors, and not a square

divisors of 36: {1, 2, 3, 4, 6, 9, 12, 18, 36}: odd # of divisors, and is a square.

I'm wondering is this just a coincidence, or does this hold for all numbers? And are there any correlations between number of divisors and if the number is a cube, a quadruple, etc?
Note that if $\displaystyle d$ is a divisor of $\displaystyle n$ then so is $\displaystyle \frac nd.$ Hence, all the divisors of $\displaystyle n$ occur in pairs $\displaystyle \left\{d,\,\frac nd\right\}.$ Furthermore $\displaystyle d=\frac nd\ \iff\ n=d^2$ is a perfect square. It folllows that if $\displaystyle n$ is not a perfect square, then it has an even number of divisors (since each pair of divisors $\displaystyle d,\,\frac nd$ will be distinct), while if $\displaystyle n$ is a perfect square then it has an odd number of divisors (the pairs $\displaystyle d,\,\frac nd$ are all distinct except for the divisor $\displaystyle d=\sqrt n\,).$

5. Originally Posted by CaptainBlack
In the case of a square all $\displaystyle \alpha$'s are even.

CB
Haha. I can't believe I said that.
Obviously I meant "all the $\displaystyle \alpha+1$".