TITLE: Total number of divisors is a prime
QUESTION [18 upvotes]: Which numbers have prime number of divisors?
For example, $16$ has $1$, $2$, $4$, $8$, $16$, a total of $5$ divisors, $5$ being a prime.
I found that primes and the power of primes such that $p^{q-1}$, where $p$ and $q$ are prime numbers, all have prime number of divisors. Is this property
limited to only these numbers?

REPLY [2 votes]: If the number is a prime or is of the form $p^{q-1}$ where both p and q are prime, then and then only the Number will have prime number of Divisors.
NOTE :- I know this is a current codechef problem.  Even after knowing this you may still  experience TLE.