This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, draghuram, mark.dickinson, rhettinger, stutzbach
Date 2010-05-12.20:34:31
SpamBayes Score 0.0066573434
Marked as misclassified No
Message-id <AANLkTim4hvDUg5ySjsPUvdaXoSJVygyQyno8COwHKg7z@mail.gmail.com>
In-reply-to <1273693664.96.0.298446297195.issue8692@psf.upfronthosting.co.za>
Content
Here is one more datapoint.

$ ./python.exe -m timeit -s "import factorial4 as fm;
fm.partial_product = fm.partial_product; f = fm.factorial " "f(10000)"
10 loops, best of 3: 66.1 msec per loop
[32794 refs]
$ ./python.exe -m timeit -s "import factorial4 as fm;
fm.partial_product = fm.partial_product3; f = fm.factorial "
"f(10000)"
10 loops, best of 3: 63 msec per loop
[32794 refs]
$ ./python.exe -m timeit -s "import factorial4 as fm;
fm.partial_product = fm.partial_product2; f = fm.factorial "
"f(10000)"
10 loops, best of 3: 43.3 msec per loop

partial_product3 multiplies adjacent numbers instead of first by last.
 I am not sure it reproduces the order of multiplication in the
recursive version exactly, but it does show that the order of
multiplication matters a lot.

I wonder if one could write an elegant recursive version that would
multiply first by last in partial_product.
Files
File name Uploaded
factorial4.py belopolsky, 2010-05-12.20:34:31
History
Date User Action Args
2010-05-12 20:34:33belopolskysetrecipients: + belopolsky, rhettinger, mark.dickinson, draghuram, stutzbach
2010-05-12 20:34:31belopolskylinkissue8692 messages
2010-05-12 20:34:31belopolskycreate