0

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 Answers2

1

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.

MJD
  • 65,394
  • 39
  • 298
  • 580
Umberto
  • 1,263
  • 8
  • 16
  • Thanks a lot! But If want to do it in maple? The same code would work? Can you help me find a code for this so that it works in maple? thanks –  Oct 11 '13 at 21:25
  • I don't have maple so cannot check directly, but it seems that here you can find some information: http://www.mapleprimes.com/questions/41246-Perfect-Numbers but it seems that Maple does not have a direct function to find the perfect numbers. You will have to write some kind of code. – Umberto Oct 11 '13 at 21:27
  • See comments above on 1 being a perfect number. – JRN Oct 12 '13 at 00:11
0

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]
acer
  • 5,293