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 steven.daprano
Recipients mark.dickinson, serhiy.storchaka, steven.daprano, tim.peters, trrhodes
Date 2020-03-21.14:16:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584800170.56.0.567976580319.issue40028@roundup.psfhosted.org>
In-reply-to
Content
I don't know... To my mind, if we are going to support working with primes, the minimum API is:

- is_prime(n)
- next_prime(n)
- prev_prime(n)
- factorise(n)
- generate_primes(start=0)

(I trust the names are self-explanatory.)

There are various other interesting prime-related factors which can be built on top of those, but the above five are, in my opinion, a minimal useful set.

Factorising negative numbers is simple: just include a factor of -1 with the prime factors. We would probably want to also support factorising 0 and 1 even though they don't have prime factors. The alternative is to raise an exception, which I expect would be more annoying than useful.
History
Date User Action Args
2020-03-21 14:16:10steven.dapranosetrecipients: + steven.daprano, tim.peters, mark.dickinson, serhiy.storchaka, trrhodes
2020-03-21 14:16:10steven.dapranosetmessageid: <1584800170.56.0.567976580319.issue40028@roundup.psfhosted.org>
2020-03-21 14:16:10steven.dapranolinkissue40028 messages
2020-03-21 14:16:10steven.dapranocreate