Hi, Since we were recently discussing speed of computing Bell numbers, maybe it would be interesting to discuss computing the number of partitions of an integer as a sum of other positive integers, i.e.,
sage: number_of_partitions(5) 7 sage: v = list(partitions(5)); v [(1, 1, 1, 1, 1), (1, 1, 1, 2), (1, 2, 2), (1, 1, 3), (2, 3), (1, 4), (5,)] sage: len(v) 7 Currently, I'm going through the "Mathematica tour" and making a SAGE version of it. The Mathematica tour is a free pdf download available here: http://documents.wolfram.com/mathematica/Mathematica_V5_Book.zip The first thing Mathematica can do that SAGE can't is compute number_of_partitions(10^9) "in a few seconds -- a frontier number theory calculation" (page 5). In SAGE it takes around 80-100 seconds to compute sage: number_of_partitions(10^8, algorithm="pari") Actually, on sage.math, Mathematica takes 67 seconds to compute the number of partitions for 10^9 and about 10 seconds to do 10^8. QUESTIONS: Why is Mathematica about 10 times faster than PARI at this? What are the best ways to compute the number of partitions of n? Is it a calculation involving fast arithmetic with dense polynomials of large degree, which would be best done using the upcoming FLINT library or NTL? It's a little embarasing that the first thing Mathematica does that SAGE doesn't do reasonably quickly in their tour is a number theory calculation. -- William -- William Stein Associate Professor of Mathematics University of Washington http://www.williamstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---