find all multiplicands and multipliers for a number

Paul Rubin at nospam.invalid
Sat Apr 11 19:52:59 CEST 2015

Marko Rauhamaa <marko at> writes:
> I think it mostly says divisions are not so evil as you think they might
> be.

They are bignum divisions which are much more expensive than machine
divisions.  And it's not just the divisions, it's also the number of
iterations through the whole loop.  And the Python 2 vs Python 3
difference is still unexplained.

> PS Note that you're being "wasteful" by multiplying c*c over and over

Yeah this is a reasonable point, though most of the c's should fit in a
machine word, at least in my 64-bit system.  I think Python still
separates ints and longs in the implementation.

More information about the Python-list mailing list