View Single Post
Old 2008-06-11, 13:22   #3
Account Deleted
Mini-Geek's Avatar
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17·251 Posts

Originally Posted by R.D. Silverman View Post
What do you mean by "calculate perfect numbers"? Do you mean

"write a program that will find p such that 2^p-1 is prime?"

Once you have such p, then a perfect number is just (2^p-1) * 2^(p-1)
Hint: this has already been done.

Or do you mean

"given a list of such p, compute 2^(p-1) * (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.
Mini-Geek is offline   Reply With Quote