Hostname: page-component-586b7cd67f-g8jcs Total loading time: 0 Render date: 2024-11-26T20:38:24.675Z Has data issue: false hasContentIssue false

Efficient implementation of the Hardy–Ramanujan–Rademacher formula

Published online by Cambridge University Press:  01 October 2012

Fredrik Johansson*
Affiliation:
Research Institute for Symbolic Computation, Johannes Kepler University, Altenberger Strasse 69, 4040 Linz, Austria (email: [email protected])

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We describe how the Hardy–Ramanujan–Rademacher formula can be implemented to allow the partition function p(n) to be computed with softly optimal complexity O(n1/2+o(1)) and very little overhead. A new implementation based on these techniques achieves speedups in excess of a factor 500 over previously published software and has been used by the author to calculate p(1019), an exponent twice as large as in previously reported computations. We also investigate performance for multi-evaluation of p(n), where our implementation of the Hardy–Ramanujan–Rademacher formula becomes superior to power series methods on far denser sets of indices than previous implementations. As an application, we determine over 22 billion new congruences for the partition function, extending Weaver’s tabulation of 76 065 congruences. Supplementary materials are available with this article.

Type
Research Article
Copyright
Copyright © London Mathematical Society 2012

References

[1]Ankeny, N., ‘The least quadratic non residue’, Ann. of Math. (2) 55 (1952) no. 1, 6572.CrossRefGoogle Scholar
[2]Apostol, T., Modular functions and Dirichlet series in number theory, 2nd edn (Springer, New York, 1997).Google Scholar
[3]Borwein, J. and Bailey, D., Mathematics by experiment: plausible reasoning in the 21st century (A K Peters, Wellesley, MA, 2003) 137.Google Scholar
[4]Borwein, J. and Borwein, P., Experimental and computational mathematics: selected writings (Perfectly Scientific Press, Portland, OR, 2010) 250.Google Scholar
[5]Brent, R. and Zimmermann, P., Modern computer arithmetic (Cambridge University Press, New York, 2011).Google Scholar
[6]Bruinier, J. and Ono, K., ‘Algebraic formulas for the coefficients of half-integral weight harmonic weak Maass forms’, Preprint, 2011, arXiv.org/abs/1104.1182.Google Scholar
[7]Calkin, N., Davis, J., James, K., Perez, E. and Swannack, C., ‘Computing the integer partition function’, Math. Comp. 76 (2007) no. 259, 16191638.CrossRefGoogle Scholar
[8]Cipolla, M., ‘Un metodo per la risoluzione della congruenza di secondo grado’, Napoli Rend. 9 (1903) 153163.Google Scholar
[9]Crandall, R. and Pomerance, C., Prime numbers: a computational perspective (Springer, New York, 2005) 99103.Google Scholar
[10]Erdős, P., ‘Remarks on number theory. I’, Mat. Lapok 12 (1961) 1017.Google Scholar
[11]Fousse, A., Hanrot, G., Lefèvre, V., Pélissier, P. and Zimmermann, P., ‘MPFR: A multiple-precision binary floating-point library with correct rounding’, ACM Trans. Math. Software 33, no. 2, 2007, http://www.mpfr.org/.CrossRefGoogle Scholar
[12] The GMP development team, ‘Computing billions of π digits using GMP’, http://gmplib.org/pi-with-gmp.html.Google Scholar
[13] The GMP development team, ‘GMP: the GNU multiple precision arithmetic library’, http://gmplib.org/.Google Scholar
[14]Hagis, P. Jr, ‘A root of unity occurring in partition theory’, Proc. Amer. Math. Soc 26 (1970) no. 4, 579582.CrossRefGoogle Scholar
[15]Hardy, G. H. and Ramanujan, S., ‘Asymptotic formulae in combinatory analysis’, Proc. Lond. Math. Soc. 17 (1918) 75115.CrossRefGoogle Scholar
[16]Hart, W., ‘Fast library for number theory: an introduction’, Mathematical software – ICMS 2010, Lecture Notes in Computer Science 6327, 88–91, http://www.flintlib.org.CrossRefGoogle Scholar
[17]Hart, W., ‘A one line factoring algorithm’, J. Aust. Math. Soc. 92 (2012) 6169.CrossRefGoogle Scholar
[18]Higham, N., Accuracy and stability of numerical algorithms, 2nd edn (SIAM, Philadelphia, 2002).CrossRefGoogle Scholar
[19] Intel corporation, Pentium processor family developer’s manual. Volume 3: architecture and programming manual, 1995, http://www.intel.com/design/pentium/MANUALS/24143004.pdf.Google Scholar
[20]Knuth, D., ‘Notes on generalized Dedekind sums’, Acta Arith. 33 (1977) 297325.CrossRefGoogle Scholar
[21]Knuth, D., Fascicle 3: generating all combinations and partitions, The Art of Computer Programming, vol. 4 (Addison-Wesley, 2005).Google Scholar
[22]Lehmer, D., ‘On the series for the partition function’, Trans. Amer. Math. Soc. 43 (1938) no. 2, 271295.CrossRefGoogle Scholar
[23]Lehmer, D., ‘On a conjecture of Ramanujan’, J. Lond. Math. Soc. 11 (1936) 114118.CrossRefGoogle Scholar
[24]Lehmer, D., ‘On the Hardy–Ramanujan series for the partition function’, J. Lond. Math. Soc. 3 (1937) 171176.CrossRefGoogle Scholar
[25] The MPIR development team, ‘MPIR: multiple precision integers and rationals’, http://www.mpir.org.Google Scholar
[26]Odlyzko, A., ‘Asymptotic enumeration methods’, Handbook of combinatorics 2 (eds Graham, R., Grötschel, M. and Lovász, L.; Elsevier, The Netherlands, 1995) 10631229, http://www.dtc.umn.edu/∼odlyzko/doc/asymptotic.enum.pdf.Google Scholar
[27] OEIS Foundation Inc, ‘The on-line encyclopedia of integer sequences’, 2011, http://oeis.org/A000041.Google Scholar
[28]Ono, K., ‘The distribution of the partition function modulo m’, Ann. of Math. (2) 151 (2000) 293307.Google Scholar
[29] The Pari/GP development team, ‘Pari/GP, Bordeaux’, 2011, http://pari.math.u-bordeaux.fr/.Google Scholar
[30]Pollack, P., ‘The average least quadratic nonresidue modulo m and other variations on a theme of Erdős’, J. Number Theory 132 (2012) no. 6, 11851202.CrossRefGoogle Scholar
[31]Rademacher, H., ‘On the partition function p(n)’, Proc. Lond. Math. Soc. 43 (1938) 241254.CrossRefGoogle Scholar
[32]Rademacher, H. and Whiteman, A., ‘Theorems on Dedekind sums’, Amer. J. Math. 63 (1941) no. 2, 377407.CrossRefGoogle Scholar
[33]Shanks, D., ‘Five number-theoretic algorithms’, Proceedings of the Second Manitoba Conference on Numerical Mathematics, 1972, 51–70.Google Scholar
[34]Stein, W. and The Sage development team, , ‘Sage: open source mathematics software’, http://www.sagemath.org.Google Scholar
[35] Sun Microsystems Inc, ‘FDLIBM version 5.3’, http://www.netlib.org/fdlibm/readme.Google Scholar
[36]Tonelli, A., ‘Bemerkung über die Auflösung quadratischer Congruenzen’, Göttinger Nachrichten (1891) 344346.Google Scholar
[37]Watkins, W. and Zeitlin, J., ‘The minimal polynomial of cos (2π/n)’, Amer. Math. Monthly 100 (1993) no. 5, 471474.Google Scholar
[38]Weaver, R., ‘New congruences for the partition function’, J. Ramanujan 5 (2001) 5363.CrossRefGoogle Scholar
[39]Whiteman, A., ‘A sum connected with the series for the partition function’, Pacific J. Math. 6 (1956) no. 1, 159176.CrossRefGoogle Scholar
[40] Wolfram Research Inc., ’Some notes on internal implementation’, Mathematica documentation center, 2011, http://reference.wolfram.com/mathematica/note/SomeNotesOnInternalImplementation.html .Google Scholar
[41]Zimmermann, P., The bit-burst algorithm, Slides presented at computing by the numbers: algorithms, precision, and complexity, Berlin, 2006, http://www.loria.fr/∼zimmerma/talks/arctan.pdf.Google Scholar