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?

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.
