XP is just a number | |
PerlMonks |
Re: Finding all divisors of an integerby Sidhekin (Priest) |
on Jul 03, 2004 at 14:01 UTC ( [id://371578]=note: print w/replies, xml ) | Need Help?? |
For small numbers, this should be straightforward ...
I would not worry about optimizing this, unless you need it for very many or very big numbers ... but then it would be something like this:
(Sorry, I missed the Math::BigInt stuff ... but I guess the algorithm above can be adapted to that case as well?) Update: Most of my code could benefit from comments. I added comments to the optimized version. Never code as if the guy who ends up maintaining your code can always maintain a proper caffeine intake.
print "Just another Perl ${\(trickster and hacker)},"
In Section
Seekers of Perl Wisdom
|
|