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 DevPascal. i have been tasked to do this for a college teacher. any help would be appreciated. and the sooner the better.

[QUOTE=Elhueno;135656]Hi all i was just wondering if anyone here has ever tried to calculate perfect numbers from scratch in Bloodshed softwares DevPascal. i have been tasked to do this for a college teacher. any help would be appreciated. and the sooner the better.[/QUOTE]
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]. 
[quote=R.D. Silverman;135672]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].[/quote] 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. 
Any program to search for an odd perfect number, if any exist?

[quote=Housemouse;135752]Any program to search for an odd perfect number, if any exist?[/quote]
[URL="http://www.oddperfect.org"]www.oddperfect.org[/URL] 
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 simpleminded (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.

All times are UTC. The time now is 22:03. 
Powered by vBulletin® Version 3.8.11
Copyright ©2000  2021, Jelsoft Enterprises Ltd.