Good eye! Your observation is correct. This is because, if then the number of divisors of is . (Can you prove it?) In the case of a square all 's are even.
You can probably answer your other question with the help of the formula above.
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?
Good eye! Your observation is correct. This is because, if then the number of divisors of is . (Can you prove it?) In the case of a square all 's are even.
You can probably answer your other question with the help of the formula above.
Note that if is a divisor of then so is Hence, all the divisors of occur in pairs Furthermore is a perfect square. It folllows that if is not a perfect square, then it has an even number of divisors (since each pair of divisors will be distinct), while if is a perfect square then it has an odd number of divisors (the pairs are all distinct except for the divisor