Prime Perfection

David Ding

September 30, 2025

Prime Perfection

A perfect number is a positive integer that equals the sum of its positive divisors, excluding itself. For example, \(6\) is a perfect number because its divisors other than itself are \(1, 2, 3\), and they add up to \(6\). On the other hand, a prime number is an integer greater than \(1\) that has exactly two divisors: \(1\) and itself. At first glance, these two types of numbers seem completely unrelated. Perfect numbers have a multitude of factors that allow the sum to reach the number itself, while prime numbers can never be perfect since their only divisor besides themselves is… well, \(1\).

But here’s the twist: perfect numbers and prime numbers actually form a perfect tag team! Certain prime numbers correspond directly to even perfect numbers, meaning we can use them to generate perfect numbers. How does this magic work? Stay tuned!

The Sigma Function

Let's put our critical thinking hat on for this section. If I tell you that a positive integer \(N \ge 2\) has the prime factorization \(p_1^{a_1}p_2^{a_2} \dots p_n^{a_n}\), where \(p_k\) is the \(k\)-th prime number in the prime factorization of \(N\), can you tell me the following:

  1. How many factors are there for \(N\)?
  2. What are the sums of those factors?

In order to answer the above questions, we have to really understand the power of prime numbers. Prime numbers are very useful in analyzing numbers because they form a sort of "basis" for all integers. Think about it. If a number is prime, then no matter how many of that number is added to form \(N\), it will not affect any other factors of \(N\) that do not have that prime number as its factor. A prime number is "pure" in the sense that it stands completely on its own. Each prime is independent, and the presence of one does not change or interfere with the presence of another. For example, multiplying a number by \(2\) will never create or remove factors of \(3\), and multiplying by \(5\) will never affect whether \(7\) is a factor. This separation gives primes their special power: they are the basic, non-overlapping ingredients that combine in different ways to make every \(N\).

So with that, and keeping in mind that \(N = p_1^{a_1}p_2^{a_2}\dots p_n^{a_n}\), let's answer the questions. To form a factor of \(N\), you choose how many times each prime appears in it: \(0 \leq b_1 \leq a_1\) copies of \(p_1\), \(0 \leq b_2 \leq a_2\) copies of \(p_2\), and so on up to \(p_n\). Each prime is independent, so your choice for one does not affect the others. This gives you \((a_1 + 1)\) choices for \(b_1\), \((a_2 + 1)\) choices for \(b_2\), and so on through \(b_n\). Multiplying these possibilities together gives the total number of factors of \(N\), which is \(\boxed{(a_1 + 1)(a_2 + 1)\dots(a_n + 1)}\).

***

Now, let's answer the second question. What happens when we add up those distinct factors? Well, back in the day, Swiss Mathematician Leonhard Euler gave this a name, the sigma function, denoted as \(\sigma(N)\), as the sum of all factors of \(N\). Now, remember how I mentioned that you can make factors of \(N\) by independently choosing the \(b_k\)'s, from \(b_1\) to \(b_n\)? Now, in order to derive the sigma function, we need to enumerate all the factors.

So how do we do it systematically? Well, for \(N = p_1^{a_1}p_2^{a_2}\dots p_n^{a_n}\), let's first focus on \(p_1\). We can pick 0 copies of \(p_1\) for our factor, 1 copy, 2 copies, and so on, up to \(a_1\) copies. Let \(M = p_2^{a_2}\dots p_n^{a_n}\), and so \(N = p_1^{a_1}M\), we can list the different factors of \(N\) containing \(M\) as \(p_1^0M, p_1^1M, p_1^2M, \dots, p_1^{a_1}M\). Adding those factors up gives us \((p_1^0 + p_1^1 + p_1^2 + \dots + p_1^{a_1})M\). Now, we rinse and repeat for \(p_2\) all the way up to \(p_n\) and obtain:

\begin{align} \sigma(N) &= \boxed{(p_1^0 + p_1^1 + p_1^2 + \dots + p_1^{a_1})(p_2^0 + p_2^1 + p_2^2 + \dots + p_2^{a_2})\dots(p_n^0 + p_n^1 + p_n^2 + \dots + p_n^{a_n})} \\ \end{align}

As an exercise, try expanding the above expression, picking say \(n = 3\). You can verify that each term of the expanded sum is a distinct factor of \(N\) and all factors are covered!

But wait, there's more! Here’s the cool part: each term in the product is actually a geometric series that starts with \(1\) (since any non-zero number raised to the power of \(0\) is \(1\)) and has a common ratio \(p_k\). Using the geometric series formula, we can simplify \(\sigma(N)\) as:

\begin{align} \sigma(N) &= \boxed{\left(\frac{p_1^{a_1 + 1} - 1}{p_1 - 1}\right)\left(\frac{p_2^{a_2 + 1} - 1}{p_2 - 1}\right)\dots\left(\frac{p_n^{a_n + 1} - 1}{p_n - 1}\right)} \\ \end{align}

***

Okay, now let's continue our journey to explore the sigma function \(\sigma(N)\). Remember how we set \(M = p_2^{a_2}\dots p_n^{a_n}\) so that \(N = p_1^{a_1}M\), and added the partial sum \((p_1^0 + p_1^1 + \dots + p_1^{a_1})M\)? Well, what is \((p_1^0 + p_1^1 + \dots + p_1^{a_1})\) by itself? By definition, it is \(\sigma(p_1^{a_1})\), the sum of all factors of \(p_1^{a_1}\), which are just the powers of \(p_1\) from 0 up to \(a_1\).

This means we can write \(\sigma(N) = \sigma(p_1^{a_1}) \cdot \sigma(M)\). In other words, if we focus on the factors coming from just one prime, the sum of all factors of \(N\) is simply the product of the sum of factors of that prime and the sum of factors of the remaining part \(M\). You can think of it as choosing one prime’s powers from its menu and multiplying by all the combinations from the other primes.

I encourage you to try this idea on your own. Understanding this will be very helpful later when we explore perfect numbers.

Generating (Even) Perfect Numbers

Imagine a prime number of the form \(2^p - 1\), where \(p \ge 2\). If I asked you to generate a perfect number from it, what would you do?

Euclid asked the same question back in Ancient Greece, and he came up with a clever solution. Instead of just giving you the proof, let's try to work it out together as if we were transported back to his time.

The natural approach is to let \(N\) be a perfect number in the form \((2^p - 1)x\), where \(x\) shares no factors with the prime number \(2^p - 1\). By the definition of a perfect number, we need \(\sigma(N) = 2N\). Writing everything out, we get:

\begin{align} 2N &= \sigma(N) \\ \\ 2(2^p - 1)x &= \sigma((2^p - 1)x) \\ \\ 2(2^p - 1)x &= \sigma(2^p - 1) \cdot \sigma(x) \quad \text{(from the multiplicative property of sigma)} \\ \\ 2(2^p - 1)x &= (1 + (2^p - 1)) \cdot \sigma(x) \quad \text{(by definition of sigma)} \\ \\ 2(2^p - 1)x &= 2^p \cdot \sigma(x) \\ \\ (2^p - 1)x &= 2^{p-1} \cdot \sigma(x) \end{align}

At this point, we can cleverly choose \(x = 2^{p-1}\). Then \(N = (2^p - 1)x = (2^p - 1)2^{p-1}\). Since both \(2\) and \((2^p - 1)\) are prime, this is the prime factorization of \(N\), and \(x\) has no factors of \(2^p - 1\). This choice satisfies the equality above.

\begin{align} (2^p - 1)x &= 2^{p-1}\sigma(x) \\ \\ \text{RHS} &= 2^{p-1} \sigma(2^{p-1}) \\ \\ &= 2^{p-1} \left( \frac{2^p - 1}{2 - 1} \right) \quad \text{(using the sigma formula)} \\ \\ &= 2^{p-1}(2^p - 1) \\ \\ &= \text{LHS} \end{align}

As desired!

So what did we just find? A perfect number generator! As long as \(2^p - 1\) is prime, and such primes are called Mersenne primes, we can generate the corresponding perfect number using \(N = 2^{p-1}(2^p - 1)\). Also, since \(2^{p-1}\) is always even, every perfect number produced this way is even.

Enter Euler to "Perfect" on Euclid's Discovery

Over 1000 years later, another brilliant mathematician, Leonhard Euler, wondered: must all even perfect numbers be of the form \(2^{p-1}(2^p - 1)\)? This is an important question because while \(2^{p-1}(2^p - 1)\) is a perfect number generator, it would be even more remarkable if every even perfect number came from that generator. Then there would be a one-to-one correspondence between Mersenne primes (\(2^p - 1\) primes) and even perfect numbers. So Euler got to work, as will we.

This time, let's assume no special structure for \(N\) except that it is an even perfect number. We can factor out all powers of 2 and write \(N\) as \(2^k M\), where \(k \ge 1\) and \(M\) is odd. By definition, \(\sigma(N) = 2N\).

\begin{align} \sigma(N) &= 2N \\ \\ \sigma(2^k M) &= 2(2^k M) \\ \\ \sigma(2^k)\sigma(M) &= 2^{k+1} M \\ \\ (2^{k+1} - 1) \sigma(M) &= 2^{k+1} M \\ \\ \sigma(M) &= 2^{k+1} \frac{M}{2^{k+1} - 1} \end{align}

Take a moment to think. Since \(k \ge 1\), \((2^{k+1} - 1)\) is at least 3 and is odd. Also, \(M\) is odd. Now, \(\sigma(M)\) is the sum of positive integers and must itself be an integer. This means \(\frac{M}{2^{k+1} - 1}\) must also be a positive integer smaller than \(M\). So \(M\) has at least two factors: \(M\) itself and \(\frac{M}{2^{k+1} - 1}\). By definition, we can write

\begin{align} 2^{k+1} \frac{M}{2^{k+1} - 1} &= M + \frac{M}{2^{k+1} - 1} + \text{other factors} \\ \\ 2^{k+1} \frac{M}{2^{k+1} - 1} &= \frac{2^{k+1} M}{2^{k+1} - 1} + \text{other factors} \\ \\ \text{other factors} &= 0 \end{align}

This shows that \(M\) has exactly two factors: \(\frac{M}{2^{k+1} - 1}\) and \(M\) itself. Therefore, \(M\) is prime and \(\frac{M}{2^{k+1} - 1} = 1\), which gives \(M = 2^{k+1} - 1\). Letting \(p = k+1\) with \(p \ge 2\), we see that every even perfect number has the form

\begin{align} 2^k M = 2^{p-1}(2^p - 1) \end{align}

where \(2^p - 1\) is prime. This confirms that our generator produces all even perfect numbers.

Where Do We Go From Here?

Believe it or not, even though we now know a unique way to generate all even perfect numbers, there are still vast uncharted territories in this area waiting to be explored. For example, we do not know if any odd perfect numbers exist. We might never know, which makes this one of the most fascinating open problems in mathematics.

Another mystery is whether there are infinitely many Mersenne primes of the form \(2^p - 1\). We do not know the answer yet, but that has not stopped humanity from searching for the next largest Mersenne prime and, by extension, the next largest even perfect number. There is a global effort called the "Great Internet Mersenne Prime Search," or GIMPS for short, which pools computing power from all over the world to hunt for the next giant Mersenne prime. If you want to contribute, you can check out their website and join the search!

The hunt for perfect numbers continues, and maybe one day, you could be the one to discover the next giant perfect number.