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, mark.dickinson, rhettinger, stutzbach
Date 2010-05-12.14:39:35
SpamBayes Score 0.0059233285
Marked as misclassified No
Message-id <AANLkTik9yHKYF6OU6fNjpSr5IeJwlKlInM7OVGG5wBej@mail.gmail.com>
In-reply-to <1273615120.59.0.0443199082885.issue8692@psf.upfronthosting.co.za>
Content
On Tue, May 11, 2010 at 5:58 PM, Mark Dickinson <report@bugs.python.org> wrote:
> Yes, I'm interested in seeing the pure Python version.

Here is my translation of the reference implementation.

> It could go into test_math, and would be a useful form of documentation.

Note that I copied the reference implementation recursive logic rather
than that in the proposed patch.  It may be better for documentation
this way.

If we end up using something like this in documentation, I would
rename nminusnumofbits() to something more readable.  Maybe "ntwos" or
"count_trailing_zeros" with an explanation why number of factors of 2
in factorial(n) is n - popcount(n).
Files
File name Uploaded
factorial.py belopolsky, 2010-05-12.14:39:21
History
Date User Action Args
2010-05-12 14:44:45belopolskysetrecipients: + belopolsky, rhettinger, mark.dickinson, stutzbach
2010-05-12 14:41:53belopolskylinkissue8692 messages
2010-05-12 14:40:26belopolskycreate