TITLE: The number of divisors of a number whose sum of divisors is a perfect square
QUESTION [6 upvotes]: 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?

REPLY [2 votes]: 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.