The even perfect numbers all have the formula
2^(p - 1)(2^p - 1)
for some prime `p`. In code that's ((1 << p) - 1) << (p - 1)
for `p` = 2, 3, 5, 7 and 13, which is why you're seeing that interesting pattern of bits.(There are no odd perfect numbers in the range under consideration.)