in reply to Re^2: Finding divisors from factors
in thread Finding divisors from factors
This needs only one multiplication per divisor, hence its O(#D) i.e. <= O(2^#P) for worst case, that's pretty optimal.
But I like the simplicity and readability compared to other suggestions, so personally I wouldn't start micro optimization now just to save 10 or 20 %.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
°) or moving data or linearizing loops
E.G. you could try to replace the maps with direct
push @D_new, ($_*$p) for @D
expressions!
This could should be faster... but I'm not very motivated to benchmark myself. :)
|
|---|