See `npartitions` in sympy/ntheory/partitions_.py <https://github.com/sympy/sympy/blob/706007ca2fe279020e099d36dd1db0e33123ac4c/sympy/ntheory/partitions_.py>
>>> npartitions(10**3) 24061467864032622473692149727991 /c On Friday, March 19, 2021 at 6:43:55 PM UTC-5 rocky.b...@gmail.com wrote: > A little background first... > > I have been working on Mathics, <https://mathics.org/> a open-source > implementation of the Wolfram Language. > > Mathics relies heavily on sympy. > > For a little while I have been working on ensuring that Steve Skiena's > Combinatorica > <https://www.abebooks.com/servlet/BookDetailsPL?bi=30794099489&searchurl=isbn%3D0201509431%26sortby%3D17&cm_sp=snippet-_-srp1-_-title1> > works > on Mathics. In doing this, I was looking for a sympy equivalent to > PartitionsP[] > <https://reference.wolfram.com/language/ref/PartitionsP.html>. > > I couldn't find anything so initially I was generating all of the > partitions using sympy.utilities.iterables.partitions and then taking the > length. > > This is horribly inefficent. Therefore I thought, I'd use the algorition > in Skiena's book which makes use of Euler's recurrence for the number of > partitions. > > It took a little bit of tweaking to get it to be reasonably efficient in > Python. The current impelemtation is here > <https://github.com/mathics/Mathics/blob/master/mathics/builtin/combinatorial.py#L105-L136> > . > > This might be of interest and use in sympy as well, so I'd like to > mention it here. > > And if there is already such a routine in sympy, I'd would be grateful to > know about. > > Thanks. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/68d33973-a385-4d00-bfc3-9a689cbb3171n%40googlegroups.com.