 mersenneforum.org Calculating perfect numbers in Pascal
 Register FAQ Search Today's Posts Mark Forums Read 2008-06-11, 06:30 #1 Elhueno   2×3×29×41 Posts Calculating perfect numbers in Pascal 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.  2008-06-11, 13:01   #2
R.D. Silverman

Nov 2003

11101001001002 Posts 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].   2008-06-11, 13:22   #3
Mini-Geek
Account Deleted

"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17·251 Posts 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^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.   2008-06-12, 13:00 #4 Housemouse   Feb 2008 408 Posts Any program to search for an odd perfect number, if any exist?   2008-06-12, 13:08   #5
bsquared

"Ben"
Feb 2007

22·859 Posts Quote:
 Originally Posted by Housemouse Any program to search for an odd perfect number, if any exist?
www.oddperfect.org   2008-06-12, 16:37 #6 philmoore   "Phil" Sep 2002 Tracktown, U.S.A. 3·373 Posts My impression of the original poster's request was that this was an assignment in programming rather than a math project. My guess is that the teacher wanted a program, which for each integer input n, computed the sum of proper divisors of n to see if it is equal to n, perhaps contained in a loop incrementing n. This can be done in a very simple-minded (and inefficient) way, or one could apply a bit of math to make the search more efficient. Perhaps the original poster should clarify what is really wanted.  Thread Tools Show Printable Version Email this Page Similar Threads Thread Thread Starter Forum Replies Last Post davar55 Miscellaneous Math 16 2011-01-29 01:53 Historian Information & Answers 4 2010-03-26 19:39 MajUSAFRet Math 3 2003-12-13 03:55 dsouza123 Math 2 2003-07-19 17:17 Zeta-Flux Math 1 2003-05-28 19:41

All times are UTC. The time now is 05:03.

Sun May 9 05:03:32 UTC 2021 up 30 days, 23:44, 0 users, load averages: 1.84, 1.59, 1.56