Perfect Numbers

A positive integer n is called perfect if [Maple Math] = [Maple Math]
For Example:

[Maple Math] = 1 + 2 + 3 + 6 = 12 = 2 * 6 = [Maple Math]
so 6 is perfect

The most recent record for the number of perfect numbers that has been found is 34. There hasn't been found an answer to the question of whether there are infinitely many perfect numbers.

Here is a program that finds perfect numbers up to a certain number j.

> P:= proc(j) local n,S;
for n from 2 to j do
S:= sigma(n);
if S = 2*n
then print (n,"is perfect");
fi;
od;
end;

[Maple Math]

> P(10);

[Maple Math]

> P(10^2);

[Maple Math]

[Maple Math]

> P(10^3);

[Maple Math]

[Maple Math]

[Maple Math]

> P(10^4);

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

The time command gives us an idea of how long, in seconds, this computation takes for the given j.

> time(P(10^4));

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

>

All 34 perfect numbers that are known are even. In fact, No one has found an odd perfect number or shown that they don't exist.

Here is a program to find odd perfect numbers up to a certain number k:

> OddP:= proc(k) local T,N,L;
T:=0;
for N from 1 to k by 2 do
if N mod 2 = 1 then
L:=sigma(N);
if L = 2*N then
print(N,"is odd perfect");
T:=T+1;fi;fi;
od;
if T < 1 then
print("No odd perfect up to",k);fi;
end;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

> OddP(10^3);

[Maple Math]

> OddP(10^4);

[Maple Math]

> OddP(10^5);

[Maple Math]

>


All of the even perfect numbers correspond to the Mersenne primes.
Mersenne numbers are of the form

[Maple Math] = [Maple Math]
where p is prime

If a Mersenne number [Maple Math] = [Maple Math] is a prime, then it is a Mersenne prime .

Examples:

[Maple Math] = 3
[Maple Math] = 7
[Maple Math] = 31
[Maple Math] = 127
[Maple Math] = 8197

are all Mersenne primes, but [Maple Math] = 2047 = 23 * 89 is only a Mersenne number since it is composite.

We can compute Mersenne primes with Maple with the mersenne command or simply just M :

>

> mersenne(3);

[Maple Math]

> M(3);

[Maple Math]

Inputing a number into the parameters outputs [Maple Math] . The parameter must be a prime-inputing a composite number returns "false":

> M(4);

[Maple Math]

> M(16);

[Maple Math]

Inputing an argument as a list with one integer outputs the ith Mersenne prime:

> M([4]);

[Maple Math]

> M([7]);

[Maple Math]

Maple only does up to 33 Mersenne primes.

> length(M([33]));

[Maple Math]

The 33rd Mersenne prime has 258716 digits.

>


Suppose n =
[Maple Math] where both p and [Maple Math] are prime - then n is perfect.

Proof: n = [Maple Math] where p and [Maple Math] are prime.

[Maple Math] = [Maple Math] [Maple Math]
=
[Maple Math] * [Maple Math] Since [Maple Math] is prime.
=
[Maple Math] * [Maple Math]
=(
[Maple Math] ) 2 * [Maple Math]
= (
[Maple Math] ) 2 * [Maple Math] = 2 * [Maple Math] ( [Maple Math] ) = 2n
therefore, n is perfect

There exists a Theorem developed by both Eulid and Euler that states n is an even perfect number if and only if n = [Maple Math] ( [Maple Math] ) where [Maple Math] is a Mersenne prime.

We have proved one part of this theorem already. Now we must prove that even perfect numbers must be of the given form. Let n be an even perfect number and write it as

n = [Maple Math] q , with q odd

Since gcd( [Maple Math] , q) = 1, then

[Maple Math] = [Maple Math] [Maple Math]
(since
[Maple Math] -function is multiplicative)
= (
[Maple Math] ) [Maple Math]
(by the definition of
[Maple Math] -function)

By the definition of a perfect number, we must also have

[Maple Math] = [Maple Math] = 2 * [Maple Math] q = [Maple Math]


Setting these two sigma(n)'s equal to each other, and letting s(q) = sum of all proper divisors of q (sum of the divisors of q minus q itself) =
[Maple Math] - q, we get

[Maple Math] = [Maple Math] [Maple Math]
=
[Maple Math] (s(q) + q)
(since
[Maple Math] = s(q) + q)

Therefore,

q = s(q)( [Maple Math] )

Clearly this implies that some integer d = s(q) is a proper divisor of q. On the other hand, s(q) was the sum of all proper divisors of q (defined above), including d, so that there cannot be any other proper divisors besides d. But a number q with a single proper divisor d must be a prime so d must equal 1. So from the above equation of q, we can write q as

q = [Maple Math]
and conclude that q is a Mersenne prime. Thus each even perfect number is of the form
[Maple Math] ( [Maple Math] )
where
[Maple Math] is a Mersenne prime.

The fact that n = [Maple Math] ( [Maple Math] ) is perfect if p and [Maple Math] are prime was known to Euclid in Elements (Book IX) around 350 B.C. The characterization of even perfect numbers is thanks to Euler sometime in the eighteenth century. Therefore, the full theorem took about 2000 years to prove.

Using this new information, we can update our old perfect number program so that it is more efficient.

> Perfect:=proc(i) local n,S;
for n from 2 do
S:=(2^(n-1))*(2^n-1);
if S > i then break; fi;
if isprime(n)
then
if
isprime(2^n-1) then
print(S,"is perfect");
fi;fi;
od;
end;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

> Perfect(10);

[Maple Math]

> Perfect(10^2);

[Maple Math]

[Maple Math]

> time(Perfect(100^50));

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

Recall that this last number is the time, in seconds, for the command Perfec t to execute this particular i.

>

A positive integer n is called multiply-perfect if [Maple Math] = k*n where [Maple Math] . The multiple k is called the multiplicity of the number. The largest known multiplicity is k=8. Here is a program that searches for multiply-perfect numbers up to a number m.

>

> MultP:= proc(m) local n,S,k;
for n from 2 to m do
S:=sigma(n);

if (S mod n) = 0
then
if S/n > 2 then print (n,"has multiplicity", S/n );
fi; fi;
od;

end;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

> MultP(10^3);

[Maple Math]

[Maple Math]

> MultP(10^5);

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

Examples of larger multiply-perfect numbers:
multiplicity 3 = 523776
multiplicity 5 = 14182439040

>