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 $\map \sigma n$ 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 $\map \sigma n$ will have $\map \sigma {p^{k_p} }$ and $\map \sigma {q^{k_q} }$ as divisors.

Hence $\map \sigma n$ will not be prime.

So for $\map \sigma n$ 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 Function of Power of Prime:


 * $\map \sigma {p^k} = \dfrac {p^{k + 1} - 1} {p - 1}$

Note that as $\map \sigma {2^k} = \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, $\map \sigma {2^k}$ 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.