# Perfect numbers, the pattern continues

The well known formula for perfect numbers is

$$P_n=2^{n-1}(2^{n}-1).$$

This formula is obtained by observing some patterns on the sum of the perfect number's divisors. Take for example $496$:

$$496=1+2+4+8+16+31+62+124+248$$

one can see that the first pattern is a sequence of powers of $2$ that stops at $16$, the second pattern starts with a prime number, in this case $31$, the rest of them are multiples of $31$, e.g. $2\cdot 31, 4\cdot 31$ and $8\cdot 31$.

But I found that the pattern proceeds after $31$, for example $31=2^5-2^0$, $62=2^6-2^1$, $124=2^7-2^2$ and finally $248=2^8-2^3$, so the perfect number can be written as

$$496=1+2+4+8+16+(2^5-2^0)+(2^6-2^1)+(2^7-2^2)+(2^8-2^3)$$

or

$$496=(1+2+4+8+16+32+64+128+256) -(1+2+4+8).$$

So the formula follows very naturally from this. I've searched but didn't find this formulation anywhere.

Well, is this something new? Has anyone seen this somewhere?

-
This is known. See en.wikipedia.org/wiki/Perfect_numbers#Even_perfect_numbers ; note this assumes that all perfect numbers are even. – Tomer Vromen Sep 26 '10 at 9:17

What you have discovered is the special case $\rm\ a = 2,\ m = n-1\$ of the following simple identity

$\rm\displaystyle\ a^{m}\:\frac{a^n-1}{a-1}\: =\: \frac{a^{m+n}-1}{a-1} - \frac{a^m-1}{a-1}\: =\: 1+a+\cdots+a^{m+n-1} - (1+a+\cdots+a^{m-1})$

For example, it yields $\ 11111000 = 11111111 - 111\$ for $\rm\ a = 10,\ m = 3,\ n = 5\:$.

However, except in the special case when the left hand side is an even perfect number, the right hand side is not the (rearranged) sum of the divisors of the left hand side, so it bears little relation to perfect numbers.

-
+1 for a succinct and clear explanation in the first paragraph. However, there's a false claim in the last paragraph. For the special case that the LHS is even perfect, the RHS is not the sum of divisors. Here's a counterexample: Let a=2, n=2, m=1 (i.e the case for 6=2*3). Now the RHS gives 6 = (1 + 2 + 4) - (1), but 4 is not a divisor, and 3 is a missing divisor. – Weaam Sep 26 '10 at 23:05
@Weaam: When the LHS is even perfect, the RHS is the OP's rearranged sum of divisors. I added the word 'rearranged' to make that clear. Thanks for the tip. – Bill Dubuque Sep 26 '10 at 23:43

The patterns you're after tell us nothing about the perfect(ness) of a number.

Since they hold even if the number is not perfect, for example, take n = 6. $2^5 (2^6-1) = 2016 = 2^{10} + 2^9 + ... + 2^5$. Which is valid for any n, since in binary, 2^6-1 is 6-1=5 1's from left, and multiplication by 2^5 is adding 5 zeros from right.

Moreover, the following also hold for any n,

$2^5 (2^6-1) = 2^0 + ... + 2^{6-1} + (2^6-2^0) + (2^{6+1} + 2^1) + ... + (2^{2*6-2} - 2^{6-2})$. $= 1 + ... + 32 + (2^6 - 2^0) + ... + (2^10 - 2^4)$.

but 2016 is not perfect.

Here, $2^n-1$ must be prime so that $2^{n-1}(2^n-1)$ is the unique prime factorization of the number, and in which case, the terms in $\sum_{k=0}^{n-1} 2^k + \sum_{k=0}^{n-2} 2^k(2^n - 1)$ are precisely the divisors of $2^{n-1}(2^n-1)$.

Theorem: If P is an even perfect number, then P = $2^{k-1} (2^k - 1)$ for some k>1 with (2^k - 1) prime.

Proof:

Suppose P is even perfect. Then we can find k>1 such that $P = 2^{k-1}m$, for m odd.

Now, $2^{k-1} - 1 = 1 + ... + 2^{k-2}$ (as explained earlier, 2^{k-1} - 1 has k-2 ones). i.e explaining why 31 = 1 + 2 + ... + 16.

Write $P = (2^{k-1}-1 + 1)m$. Then $P = (1 + ... + 2^{k-2})m + m$.

The case m is prime: The proper divisors of P are then $1,2, ..., 2^{k-1}, m, 2m, ..., 2^{k-2}m$.

Since P is assumed perfect, $P = 1 + 2 + ... + 2^{k-1} + m + 2m + ... + 2^{k-2}m$.

But $P = (1 + ... + 2^{k-2})m + m$ as shown above.

Therefore, $m = 1 + 2 + ... + 2^{k-1} = 2^{k}-1$

i.e $P = 2^{k-1} (2^k - 1)$ (note 2^{k}-1 prime).

The case for m is not prime: Assume without loss of generality $m = p_1 p_2$, neither a unit or even. Then the divisors (hopefully I didn't miss a divisor) of P are: $1,2, ..., 2^{k-1}, p_1, 2p_1, ... 2^{k-1}p_1, p_2, 2p_2, ... 2^{k-1}p_2, 2m, ..., 2^{k-2}m$.

Taking the sum of the divisors and equating with $P = (1 + ... + 2^{k-2})m + m$. Then $m = 1 + 2 + ... + 2^{k-1} + (1 + ... + 2^{k-1})p_1 + (1 + ... + 2^{k-1})p_2 = (2^{k} - 1) (1 + p_1 + p_2)$, but then $p_1 = (1 + p_1 + p_2)$, i.e p_2=-1 or $p_2 = (1 + p_1 + p_2)$, in either case a contradiction.

-
My intention wasn't to provide a formula giving only perfect numbers, my aim was to deduce the formula, and of course it only gives perfect numbers when $(2^{n}-1)$ is prime. Please see also my answer to muad. – Neves Sep 25 '10 at 21:16
I edited my post and included a proof of "If P is even perfect then $P = 2^{k-1}(2^k - 1)$ with (2^k - 1) prime." – Weaam Sep 25 '10 at 22:44
But do you see now why the patterns are irrelevant? Since they're only a consequence of 2^{k−1} (2k−1) in general, not in the particular case that (2k−1) is prime, they can't be used as a defining property of "perfectness". – Weaam Sep 26 '10 at 0:03

You've observed that $P_5 = 2^4(2^5-1) = 496$ can also be written as the sum of the first 9 powers of two minus the sum of the first four powers of two.

Sums of powers of two

Powers of two written in binary look like $1, 10, 100, 1000, \cdots$ but you can also write them like this $1, 1+1, 11+1, 111+1, \cdots$. This explains why (now in decimal notation) $1 + 2 + 4 + 8 = 15$ and the general sums of this form.

Nine and four

Well obvious $4 = 5-1$, and $9 = 2\cdot 5 - 1$, but where do these come from? Well just multiply out the formula! $2^{n-1}(2^n-1) = 2^{2n-1}-2^{n-1}$.

This explains why the form $(1 + 2 + 4 + 8 + \cdots) - (1 + 2 + \cdots)$ works.

-
My question was... – Neves Sep 25 '10 at 18:42
@A.Neves, please write a full sentence. – anon Sep 25 '10 at 18:58
@muad, Usually we are presented with the formula for perfect numbers, sometimes it is deduced some times it is not. I present two ways of deduction, the second one usually is not used. I'm asking if anyone has seen it somewhere. – Neves Sep 25 '10 at 20:45