Quote:
Originally Posted by Elhueno
Hi all i was just wondering if anyone here has ever tried to calculate perfect numbers from scratch in Bloodshed softwares Dev-Pascal. i have been tasked to do this for a college teacher. any help would be appreciated. and the sooner the better.
|
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].