mersenneforum.org  

Go Back   mersenneforum.org > New To GIMPS? Start Here! > Homework Help

Reply
 
Thread Tools
Old 2008-06-11, 06:30   #1
Elhueno
 

3·1,801 Posts
Default 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.
  Reply With Quote
Old 2008-06-11, 13:01   #2
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

26·113 Posts
Default

Quote:
Originally Posted by Elhueno View Post
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].
R.D. Silverman is offline   Reply With Quote
Old 2008-06-11, 13:22   #3
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

102538 Posts
Default

Quote:
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
Old 2008-06-12, 13:00   #4
Housemouse
 
Housemouse's Avatar
 
Feb 2008

3210 Posts
Default

Any program to search for an odd perfect number, if any exist?
Housemouse is offline   Reply With Quote
Old 2008-06-12, 13:08   #5
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

13×257 Posts
Default

Quote:
Originally Posted by Housemouse View Post
Any program to search for an odd perfect number, if any exist?
www.oddperfect.org
bsquared is offline   Reply With Quote
Old 2008-06-12, 16:37   #6
philmoore
 
philmoore's Avatar
 
"Phil"
Sep 2002
Tracktown, U.S.A.

22·32·31 Posts
Default

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.
philmoore is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Odd Perfect Numbers davar55 Miscellaneous Math 16 2011-01-29 01:53
Calculating large numbers Historian Information & Answers 4 2010-03-26 19:39
Perfect Numbers MajUSAFRet Math 3 2003-12-13 03:55
Identifing perfect squares and calculating square roots.. dsouza123 Math 2 2003-07-19 17:17
Odd Perfect Numbers Zeta-Flux Math 1 2003-05-28 19:41

All times are UTC. The time now is 20:08.

Mon Nov 23 20:08:34 UTC 2020 up 74 days, 17:19, 3 users, load averages: 2.08, 2.44, 2.47

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.