The number of divisors of a number whose sum of divisors is a perfect square

Let $n$ denote a non-prime whose sum of divisors is a perfect square.

I have noticed a few surprising facts on the number of divisors of $n$:

• It is either prime or semi-prime or $27$ in all cases
• It is even only when $n=9$ or $n=2401$ (see table below)

A few examples:

 Number | List of divisors     | Sum of divisors | Number of divisors
--------|----------------------|-----------------|--------------------
9      | 1, 3                 | 4               | 2
--------|----------------------|-----------------|--------------------
12     | 1, 2, 3, 4, 6        | 16              | 5
--------|----------------------|-----------------|--------------------
15     | 1, 3, 5              | 9               | 3
--------|----------------------|-----------------|--------------------
24     | 1, 2, 3, 4, 6, 8, 12 | 36              | 7
--------|----------------------|-----------------|--------------------
2401   | 1, 7, 49, 343        | 400             | 4


I have asserted this up to $1$ million:

• $1$ case where the number of divisors is $2$
• $1$ case where the number of divisors is $4$
• $4$ cases where the number of divisors is $27$
• $2514$ cases where the number of divisors is an odd prime
• $165$ cases where the number of divisors is an odd semi-prime

Is any proof or related-research with regards to any of these observations?

• Typically the sum and the number of divisors of $n$ include $n$ itself (otherwise they are called proper divisors). Clearly you are referring to the sum proper divisors. Are you referring to the number of proper divisors as well? – Jaycob Coleman Jan 27 '15 at 9:04
• @JaycobColeman: Obviously, yes (since I counted the number of summed elements). BTW, I wasn't aware of this terminology of "proper divisors", I just relied on the same convention used for perfect numbers. – barak manos Jan 27 '15 at 12:43

The only numbers with exact $2$ proper divisors are the numbers of the form $p^2$, where p is a prime.

The proper divisors are $1$ and $p$ in this case, and $p+1$ with $p$ prime can only be a perfect square for $p=3$.

This follows from the equation $p=a^2-1=(a-1)(a+1)$. If $a>2$ , then $p$ cannot be a prime.

So, there is only $1$ case of $2$ divisors.

For the case of $4$ divisors, we have to find all primes $p$, such that $p^3+p^2+p+1=(p+1)(p^2+1)$ is a perfect square.

Suppose, $q$ is a divisor of $p+1$ and $p^2+1$, so we have $p\equiv -1\ (\ mod\ q\ )$ and $p^2\equiv -1\ (\ mod\ q\ )$.

Since we also have $p^2\equiv 1\ (\ mod\ q\ )$, we can conclude $q=2$.

The case $gcd(p+1,p^2+1)=1$ would imply, that $p+1$ is a square, which is only possible for $p=3$, as already mentioned, but $3^2+1=10$ is not a square.

So, we can conclude that

$$p+1=2a^2\ \ \ \ \ \ \ p^2+1=2b^2$$

with $gcd(a,b)=1$

It seems that only $p=7$ solves these equations. If there is another solution, it must contain more than $100\ 000$ digits which I checked examining the solutions of the equation $x^2-2y^2=-1$

The number of proper divisors is even only for squares. I checked them and found two more examples for an even number :

$$35713^2=1275418369$$

has $8$ proper divisors.

$$102851^2=10578328201$$

has $14$ proper divisors.

Furthermore, I found an example with $3$ distinct prime factors :

$195534000$ has $399=3\times 7 \times 19$ proper divisors.

• OK, thanks. That explains one (small) section in the observations above. – barak manos Jan 26 '15 at 19:02
• Can you prove a similar argument for $7^4(=2401)$? – barak manos Jan 26 '15 at 19:03
• BTW, despite the assertion of up to $1$ million, I'm not $100$% positive that the bulk part of these observations (either prime or semi-prime or $27$ in all cases, and only two cases of even numbers) holds infinitely. – barak manos Jan 26 '15 at 19:06
• Of course. I initially thought that the next one would be $31^3+31^2+31+1$... But it's not. BTW, I would still need to prove that no other value with an even number of divisors exists (which is the bulk part of the "evenness" section of my question). – barak manos Jan 26 '15 at 19:17
• $1105280$ has $63$ proper divisors , $3189456$ has $99$ proper divisors. – Peter Jan 26 '15 at 23:16