Exercise from Beginning Number Theory by Neville Robbins:
Let $\sigma(a)$ denote the sum of divisors of $a$.Then we have to prove that if $\sigma(p^m)=2^n$ for some prime $p$,then $m=1$ and $n$ is a prime.
The result does not hold for $p=2$.Now,$$\dfrac{p^{m+1}-1}{p-1}=2^n$$
$$\implies p^{m+1}-1=2^n(p-1)$$
Then,$$p^{m+1}\equiv 1\pmod {2^n}$$ and $$p^{m+1}\equiv 1\pmod {p-1}$$ I can't go anywhere from here.A hint will be appreciated.
Excluding $m = 0$ - when $\sigma(p^0) = 2^0$ - we see that $p$ must be an odd prime, since $\sigma(2^m) \equiv 1 \pmod{2}$. So $\sigma(p^m) = 1 + p + \dotsc + p^m \equiv m+1 \pmod{2}$ forces $m$ to be odd. Then let $k = \frac{m+1}{2}$ in
$$\sigma(p^m) = \frac{p^{2k}-1}{p-1} = (p^k+1)\cdot\frac{p^k-1}{p-1}.$$
If $\sigma(p^m) = 2^n$, then $p^k+1 = 2^r$ and $\dfrac{p^k-1}{p-1} = 2^s$, where $r+s = n$ and $s < r$. Since $\gcd(p^k+1,p^k-1) = \gcd(p^k+1,2) = 2$, it follows that $s \leqslant 1$, and $\frac{p^k-1}{p-1} = 1 + p + \dotsc + p^{k-1} \leqslant 2$ then yields $k = 1$ and hence $m = 1$, so $p = 2^n-1$.
If $2^n-1$ is prime, then $n$ itself must be prime: $2^t-1$ is a nontrivial divisor of $2^{s\cdot t}-1$ for all $s,t > 1$, so $2^n-1$ is composite when $n$ is composite (and often also when $n$ is prime).