Quote:
Originally Posted by R.D. Silverman
What do you mean by "calculate perfect numbers"? Do you mean
"write a program that will find p such that 2^p1 is prime?"
Once you have such p, then a perfect number is just (2^p1) * 2^(p1)
Hint: this has already been done.
Or do you mean
"given a list of such p, compute 2^(p1) * (2^p 1)"??
If so, you must again specify what you mean by "compute".
Do you mean "calculate the decimal representation"? or "calculate the
hex representation"? or "calculate the binary representation"?? [the latter
two are trivial].

I'd assume he meant a program that finds perfect numbers by factoring numbers, adding their factors, then seeing if those two are equal. A better way to calculate, as you suggested, would be to find Mersenne primes (preferably by LL test) and know the perfect numbers by that.
I think a better, revised question would be how to write the LL test in Pascal.