find all multiplicands and multipliers for a number
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Apr 12 00:29:29 EDT 2015
On Sun, 12 Apr 2015 02:24 pm, Paul Rubin wrote:
> Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:
>> Ah, the penny drops! Are you using Python 2.7 with old-style division?
>> That would explain it.
>
> Yes, see also the use of the print statement in that post. I'm
> surprised the code compiled at all in Python 3.
I wasn't using Python 3. I was using 2.7 with "from __future__ import
division", as the BDFL intended :-)
>> Nice! Except that your fac() function has a bug: it includes 1 as a prime
>> factor for some values, which is strictly incorrect.
>
> Good catch, I noticed that too after posting.
>
> This might be of interest:
>
> http://wrap.warwick.ac.uk/54707/1/WRAP_Hart_S1446788712000146a.pdf
>
> I haven't tried figuring it out or coding it yet.
Thanks!
--
Steven
More information about the Python-list
mailing list