# Thread: I need help with an algotrithm

1. ## I need help with an algotrithm

Trying to figure out the algotrithm that will find all perfect numbers between 1 and any given int.
A perfect number is defined as: A perfect number is an integer that is equal to the sum of it's divisors as an example 6 is divisible by 1,2 and 3 and 6=1+2+3.

Any help or ideas would be great, thanks.  Reply With Quote

2. Why don't you tell us what you've got so far (a skeleton is fine), and let us help you by filling up the missing parts?

Peace always,
&lt;jdenny&gt;  Reply With Quote

3. Here is what i know:
Find how many factors of n - this is where i am confused, i am not exactly sure how to find all the factors, if it matters i am using java to do it....the main reason is i dont know how big to make the array for the factors...

Check to see if the f1 + f2 ... = n  Reply With Quote

4. That's a good start!

For a recent discussion of how to find all the factors of a given integer, follow this thread:

Then instead of displaying the factors, store them in an array, and check to see if the sum is equal to the integer.

Peace always,
&lt;jdenny&gt;  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•