Do you know where your variables are? | |
PerlMonks |
Re^2: Finding divisors from factorsby danaj (Friar) |
on Oct 08, 2014 at 22:27 UTC ( [id://1103235]=note: print w/replies, xml ) | Need Help?? |
Thanks Rolf. The powerset solution was mainly to point out this simple way. It does work -- one just needs to remove duplicates using a hash. It looks like your solution is very similar to my followup, we just do the multiply through a little different. The time is pretty close, and both faster than my earlier solutions. They also have the advantage of not doing excess computation, which is important when we move to bigints where every operation is expensive (with Math::BigInt at least).
In Section
Seekers of Perl Wisdom
|
|