Perfect numbers

Perfect numbers with the property that Apply[Plus, Divisors[n]] 2n have been studied since at least the time of Pythagoras around 500 BC. The first few perfect numbers are {6, 28, 496, 8128, 33550336} (a total of 39 are currently known). It was shown by Euclid in 300 BC that 2^{n - 1}(2^{n} - 1) is a perfect number whenever 2^{n} - 1 is prime. Leonhard Euler then proved around 1780 that every even perfect number must have this form. The values of n for the known Mersenne primes 2^{n} - 1 are shown below. These values can be found using the so-called Lucas-Lehmer test Nest[Mod[#^{2} - 2, 2^{n} - 1] &, 4, n - 2] 0, and in all cases n itself must be prime.

Whether any odd perfect numbers exist is probably the single oldest unsolved problem in mathematics. It is known that any odd perfect number must be greater than 10^{300}, must have a factor of at least 10^{6}, and must be less than 4^{4}^{s} if it has only s prime factors. Looking at curve (b) on page 135, however, it does not seem inconceivable that an odd perfect number could exist. For odd n up to 500 million the only values near 0 that appear in the curve are {-6, -5, -4, -2, -1, 6, 18, 26, 30, 36}, with, for example, the first 6 occurring at n = 8925 and last 18 occurring at n = 159030135. Various generalizations of perfect numbers have been considered, requiring for example IntegerQ[DivisorSigma[1, n]/n] (pluperfect) or Abs[DivisorSigma[1, n] - 2n] < r (quasiperfect).