in reply to Finding all divisors of an integer
This sounds like a homework problem. Yet nonetheless, let me give a shot at answering your question. Basically what you are asking for is an algorithm that finds the smallest prime number a given number is divisible by (except for the multiplicative identity). So, in your case, the smallest prime that 20 is divisible by is 2, giving your a remainder of 10. The smallest prime 10 is divisible by is, again, 2, giving you a remainder of 5. Five, in itself is prime, so you're done.
So, 20 is made up of 2,2,5, and of course the multiplicative identity. Multiplying together the different combinations of the found primes, gives you the factors you were asked to find.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Finding all divisors of an integer
by pbeckingham (Parson) on Jul 04, 2004 at 16:25 UTC | |
by gri6507 (Deacon) on Jul 05, 2004 at 16:40 UTC | |
by Anonymous Monk on Jul 21, 2010 at 23:06 UTC |