<s>[INST] Form of even perfect numbers From the list of even perfect numbers
http://en.wikipedia.org/wiki/List_of_perfect_numbers
it can be observed that all of them have either 6 or 8 as a last digit. 
Is this true for all even perfect numbers?
In other words, does one of the congruences 
$$n\equiv 1 \ (\text{mod 5}), \quad  n\equiv 3 \ (\text{mod 5})$$
hold for any even perfect number n? I suppose there are results of this kind but couldn't find any. 
 [/INST] Every even perfect number is of the form $2^{p-1}(2^p - 1)$ where $2^p - 1$ is a (Mersenne) prime. Note that $p$ must be prime – if $p = ab$ with $a, b > 1$ then
$$2^p - 1 = 2^{ab} - 1 = (2^a)^b - 1 = (2^a - 1)(1 + 2^a + 2^{2a} + \dots\ + 2^{a(b-1)}).$$
If $p = 2$, we obtain the first perfect number $6$ which satisfies $ 6 \equiv 1\ (\text{mod 5})$. Every other prime is odd, so let $p = 2k + 1$. Then 
$$2^{p-1}(2^p - 1) = 2^{2k}(2^{2k+1} - 1) = 2.2^{4k} - 2^{2k} = 2.16^k - 4^k \equiv 2 - (-1)^k\ (\text{mod 5}).$$
So, for $p = 2k + 1$,
$$2^{p-1}(2^p - 1) \equiv \begin{cases}
1 \ (\text{mod 5}) & \text{if }k\text{ is even}\newline
3 \ (\text{mod 5}) & \text{if }k\text{ is odd}.
\end{cases}$$
</s>