Computer Science Canada Friendly Numbers |
Author: | bigdaddyHess [ Wed Apr 09, 2003 2:45 pm ] |
Post subject: | Friendly Numbers |
how can i print a list of friendly numbers (up to 20000 btw)? two numbers are friendly is the sum of factors of one is equal to the other number for eg. 220 & 284 sum of factors of 220 is equal to 284 and sum of factors of 284 is equal to 220 |
Author: | Tony [ Wed Apr 09, 2003 2:51 pm ] | ||
Post subject: | |||
the simpliest way I can think of is start finding sums of factors of the first number. Then take the sum, add up its factors and see if it equals to original number or not.
all thats left is writing a function to addup the factors. I actually think someone already posted it somewhere on this board. (try using search feature) |
Author: | Prince [ Wed Apr 09, 2003 5:58 pm ] | ||
Post subject: | |||
no searching involved |
Author: | bigdaddyHess [ Thu Apr 10, 2003 2:06 pm ] |
Post subject: | thnx |
thnx tony your answer is ownage |