Integers with Prime Values of Divisor Sum

Theorem
The sequence of integer whose $\sigma$ value is prime begins:

Proof
Apart from $2$, all primes are odd.

From Sigma Function Odd iff Argument is Square or Twice Square, for $\sigma \left({n}\right)$ to be odd it needs to be of the form $m^2$ or $2 m^2$.

Suppose $n$ has two coprime divisors $p$ and $q$, each to power $k_p$ and $k_q$ respectively.

Then $\sigma \left({n}\right)$ will have $\sigma \left({p^{k_p} }\right)$ and $\sigma \left({q^{k_q} }\right)$ as divisors.

Hence $\sigma \left({n}\right)$ will not be prime.

So for $\sigma \left({2}\right)$ to be prime, $n$ can have only one prime factor.

This gives possible values for $n$ as:
 * powers of $2$, either odd or even

or:
 * even powers of a prime number.

These can be investigated in turn, using Sigma of Power of Prime:


 * $\sigma \left({p^k}\right) = \dfrac {p^{k+1} - 1} {p - 1}$

Note that as $\sigma \left({2^k}\right) = \dfrac {2^{k + 1} - 1} {2 - 1} = 2^{k + 1} - 1$ it is necessary for powers of $2$ merely to report the appropriate Mersenne prime.

Hence when $k + 1$ is not prime, $\sigma \left({2^k}\right)$ will not be prime and there is no need to test it.

Thus we test all $n$ such that:
 * $n = p^{2 k}$ for prime $p$
 * $n = 2^k$ where $k + 1$ is prime

and so:

Hence the sequence as given.