My preference is option #1. Note that all of the current options to number_of_partitions are still available through Partitions(*).cardinality() so no functionality is being lost
One issue in favour of option #2 is that the fastest algorithm available changes frequently (hence the choice of algorithm in the number_of_partitions function). Currently it is Bober's algorithm but trac #13199
implements a significantly faster algorithm which lives natively in FLINT. This patch depends on #12173 which updates FLINT to version 2.3. There seem to be some issues with the upgrade to FLINT 2.3 but as soon as they are resolved it should be possible to merge #13199 quickly into sage (I'm happy to review it).
Among other things, the patch #13072 cleans up sage.combinat.partition. I would like some input as to should happen to the function number_of_partitions.
Arguably, if you want to compute the number of partitions of some integer in sage then you should use the Partitions class:sage: Partitions(2000).cardinality()It has been suggested, however, that in some applications that the extra overhead required to create the Partitions class would be significant and, consequently, that it is better to keep a stand alone number_of_partitions function for *fast* computations of the partition function.
4720819175619413888601432406799959512200344166
Currently, in the global namespace number_of_partitions points tosage.combinat.partition.number_of_partitionsThis function does some mild argument parsing, most of which is historical in that it allows you to choose between different algorithms -- which you almost certainly do not want to do because the non-default algorithms are (significantly) slower than the default algorithm. There is also an option to allow you to compute the number of k-tuples of partitions which sum to n, for which one can/should use PartitionTuples(n).cardinality() -- although, see #11476.
If there is a need to have a *fast* number_of_partitions implementation of the partition function then I think that we should deprecate all of the argument parsing and have the function in the global point directly to the default implementation, which is currently Bober's algorithm in sage.combinat.partitions.number_of_partitions. Currently, the function number_of_partitions is effectively a wrapper to this function with some extra argument parsing on top to slow it down.
This decreases the pedagogical value of Sage code for no good reason.
In the long run I definitely vote for option 1, with
sage.combinat.partitions.number_of_partitions pointing at any time to
whatever implementation is fastest. I am also all fine with option 1
in the short run if the user gets a useful error message when passing
extra options; something like:
sage: number_of_partitions(4, <some options>)
Error ... options ... not supported anymore ...
Please use Partitions(n, <options>)
Otherwise I vote for option 2 as a first round, and option 1 later.
But that's just my 2 cents!