New user need help with perfect numbers. 
Author Message
 New user need help with perfect numbers.

Hi, how are you?  I'm wanting to write a new method to return true or
false depending on whether the receiver is a perfect number.  A perfect
number is one that is equal to all of its factors other than itself.
(ie. 6 = 1 + 2 + 3).  The only thing is, I have no idea where to start,
let alone finish. Any comments or advice you may have would really be
greatly appreciated. Thanks a lot.


Wed, 29 Jul 1998 03:00:00 GMT  
 New user need help with perfect numbers.
My advice is to go to the old fashioned library and look up perfect
numbers. Sorry if this sounds flippant, but the science of algorithms for
perfect numbers is anything but simple, based on some reading I did too
long ago to remember. I'm knows there's algorithms out there somewhere,
but it tested some pretty high-powered computers once you get into large
numbers (which you do in an incredible hurry). This is not a simple
question and you may not get much immediate luck in this Forum (although
this statement may just be taken as a challenge by some smart user, so who
knows). Personally, if the answer is not already in my head, I'm just too
busy to speand much time on it. Try the library.


Thu, 30 Jul 1998 03:00:00 GMT  
 New user need help with perfect numbers.

Quote:

>Hi, how are you?  I'm wanting to write a new method to return true or
>false depending on whether the receiver is a perfect number.  A perfect
>number is one that is equal to all of its factors other than itself.
>(ie. 6 = 1 + 2 + 3).  The only thing is, I have no idea where to start,
>let alone finish. Any comments or advice you may have would really be
>greatly appreciated. Thanks a lot.

I presume that you mean that it's equal to the SUM of all of its (prime)
factors, excluding itself.

I also assume that this is a homework assignment you hope someone will
do?? :-)

Let's list what you know:

* Perfect numbers are the sum of all prime factors
  (excluding the number, but including 1.)

* Sums are easy, given the numbers to add.

* The numbers to add are the factors.

Thus, you need to find the factors and then add them up. Finding the
prime factors of an integer is an old problem, and one that either you've
had before or is readily available in a text book. There are simple (and
slow) solutions too. You probably don't need anything more than brute
force, and if you think about it a bit...

Dave

__________________________________
David N. Smith



IBM T J Watson Research Center
Hawthorne, NY
__________________________________
Any opinions or recommendations
herein are those of the author  
and not of his employer.



Thu, 30 Jul 1998 03:00:00 GMT  
 New user need help with perfect numbers.

Quote:

>Hi, how are you?  I'm wanting to write a new method to return true or
>false depending on whether the receiver is a perfect number.  A perfect
>number is one that is equal to all of its factors other than itself.
>(ie. 6 = 1 + 2 + 3).  The only thing is, I have no idea where to start,
>let alone finish. Any comments or advice you may have would really be
>greatly appreciated. Thanks a lot.

I presume that you mean that it's equal to the SUM of all of its (prime)
factors, excluding itself.

I also assume that this is a homework assignment you hope someone will
do?? :-)

Let's list what you know:

* Perfect numbers are the sum of all prime factors
  (excluding the number, but including 1.)

* Sums are easy, given the numbers to add.

* The numbers to add are the factors.

Thus, you need to find the factors and then add them up. Finding the
prime factors of an integer is an old problem, and one that either you've
had before or is readily available in a text book. There are simple (and
slow) solutions too. You probably don't need anything more than brute
force, and if you think about it a bit...

Dave

__________________________________
David N. Smith



IBM T J Watson Research Center
Hawthorne, NY
__________________________________
Any opinions or recommendations
herein are those of the author  
and not of his employer.



Thu, 30 Jul 1998 03:00:00 GMT  
 New user need help with perfect numbers.

Quote:

>Hi, how are you?  I'm wanting to write a new method to return true or
>false depending on whether the receiver is a perfect number.  A perfect
>number is one that is equal to all of its factors other than itself.
>(ie. 6 = 1 + 2 + 3).  The only thing is, I have no idea where to start,
>let alone finish. Any comments or advice you may have would really be
>greatly appreciated. Thanks a lot.

 Hmm, could it be, that we do *your* homework at the university ?

 General hint: search for the algorithm, then do the programming. Read
books. If you've the algorithm you're often quite close to your program.

 Marten



Fri, 31 Jul 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. New user needs help

2. New Labview user need help....

3. New tcl user needs help

4. A new user of CMU Clisp help needed?

5. Perfect Numbers

6. Perfect Numbers

7. ASM to test Perfect Number

8. Finding perfect numbers

9. Perfect Number

10. Perfect Numbers, Complexity

11. Yet another perfect number program

12. Yet another perfect number program

 

 
Powered by phpBB® Forum Software