Perfect numbers less than 10 000

1.1k Views Asked by At

Im trying to find perfect numbers less that 10 000. I was told that the best way to do this is by using maple, but I don't know how to use latex except the basics like graphing. Can someone help me do this in maple? thanks.

2

There are 2 best solutions below

3
On BEST ANSWER

You can find much in wiki (http://en.wikipedia.org/wiki/Perfect_number):

In number theory, a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself.

And Douglas ist right. Check http://en.wikipedia.org/wiki/List_of_perfect_numbers

Hope that helps.

You don't need to use maple. You can use c. Try this code (I very quickly wrote it)

int main() {
  int n, i, sum;

  for (n=0; n<10000; n++) {
    i=1;
    sum=0;

    while (i<n) {
      if (n%i == 0)
        sum = sum+i;
      i++;
    }
    if (sum == n)
      printf("%d\n", i);
  }
  return 0;
} 

Output is

1
6
28
496
8128

Hope that helps.

0
On

In Maple,

seq(`if`(`+`(numtheory:-divisors(i)[])=2*i,i,NULL),i=1..9999);

                    6, 28, 496, 8128

Or, if you accept some background theory as given,

restart:

i:=1:
k:=numtheory:-mersenne([i]):
T:=k*((k+1)/2):
L:=[]:
while T < 10000 do
   L:=[L[],T];
   i:=i+1;
   k:=numtheory:-mersenne([i]);
   T:=k*((k+1)/2);
end do:
L;

                   [6, 28, 496, 8128]