Abstract
Fundamental mathematical constants such as e and π are ubiquitous in diverse fields of science, from abstract mathematics and geometry to physics, biology and chemistry^{1,2}. Nevertheless, for centuries new mathematical formulas relating fundamental constants have been scarce and usually discovered sporadically^{3,4,5,6}. Such discoveries are often considered an act of mathematical ingenuity or profound intuition by great mathematicians such as Gauss and Ramanujan^{7}. Here we propose a systematic approach that leverages algorithms to discover mathematical formulas for fundamental constants and helps to reveal the underlying structure of the constants. We call this approach ‘the Ramanujan Machine’. Our algorithms find dozens of well known formulas as well as previously unknown ones, such as continued fraction representations of π, e, Catalan’s constant, and values of the Riemann zeta function. Several conjectures found by our algorithms were (in retrospect) simple to prove, whereas others remain as yet unproved. We present two algorithms that proved useful in finding conjectures: a variant of the meetinthemiddle algorithm and a gradient descent optimization algorithm tailored to the recurrent structure of continued fractions. Both algorithms are based on matching numerical values; consequently, they conjecture formulas without providing proofs or requiring prior knowledge of the underlying mathematical structure, making this methodology complementary to automated theorem proving^{8,9,10,11,12,13}. Our approach is especially attractive when applied to discover formulas for fundamental constants for which no mathematical structure is known, because it reverses the conventional usage of sequential logic in formal proofs. Instead, our work supports a different conceptual framework for research: computer algorithms use numerical data to unveil mathematical structures, thus trying to replace the mathematical intuition of great mathematicians and providing leads to further mathematical research.
Similar content being viewed by others
Data availability
All the results of the Ramanujan Machine project are shared in the paper, with newer updates appearing periodically on the project website.
Code availability
Code is available at: http://www.ramanujanmachine.com/ and the GitHub links therein.
References
Finch, S. Mathematical Constants (Cambridge Univ. Press, 2003).
Bailey, D., Plouffe, S. M., Borwein, P. & Borwein, J. The quest for pi. Math. Intell. 19, 50–56 (1997).
Apéry, R. Irrationalité de ζ(2) et ζ(3). Asterisque 61, 11–13 (1979).
Zeilberger, D. & Zudilin, W. The irrationality measure of pi is at most 7.103205334137…. Moscow J. Combin. Number. Theory 9, 407–419 (2019).
Zudilin, W. An Apérylike difference equation for Catalan’s constant. J. Combin. 10, R14 (2003).
Hardy, G. H. & Wright, E. M. An Introduction to the Theory of Numbers 5th edn (Oxford Univ. Press, 1980).
Berndt, B. C. Ramanujan’s Notebooks (Springer Science & Business Media, 2012).
Appel, K. I. & Haken, W. Every Planar Map Is Four Colorable Vol. 98 (American Mathematical Society, 1989).
Wilf, H. S. & Zeilberger, D. Rational functions certify combinatorial identities. J. Am. Math. Soc. 3, 147–158 (1990).
McCune, W. Solution of the Robbins problem. J. Autom. Reason. 19, 263–276 (1997).
Hales, T. C. A proof of the Kepler conjecture. Ann. Math. 162, 1065–1185 (2005).
Lample, G. & Charton, F. Deep learning for symbolic mathematics. In ICLR Conf. https://openreview.net/forum?id=S1eZYeHFDS (2020).
Cranmer, M. et al. Discovering symbolic models from deep learning with inductive biases. Preprint at https://arxiv.org/abs/2006.11287 (2020).
Turing, A. M. On computable numbers, with an application to the Entscheidungsproblem. Proc. Lond. Math. Soc. s242, 230–265 (1937).
Asimov, I. & Shulman, J. A. Isaac Asimov’s Book of Science and Nature Quotations (Weidenfeld & Nicolson, 1988).
Bohr, N. Rydberg’s Discovery Of The Spectral Laws (C.W.K. Gleerup, 1954).
Shimura, G. Modular forms of half integral weight. In Modular Functions of One Variable I 57–74 (Springer, 1973).
Cuyt, A. A., Petersen, V., Verdonk, B., Waadeland, H. & Jones, W. B. Handbook Of Continued Fractions For Special Functions (Springer Science & Business Media, 2008).
Scott, J. F. The Mathematical Work Of John Wallis (1616–1703) (Taylor and Francis, 1938).
Bowman, D. & Laughlin, J. M. Polynomial continued fractions. Acta Arith. 103, 329–342 (2002).
McLaughlin, J. M. & Wyshinski, N. J. Real numbers with polynomial continued fraction expansions. Acta Arith. 116, 63–79 (2005).
Press, W. H. Seemingly Remarkable Mathematical Coincidences Are Easy To Generate (Univ. Texas, 2009).
Euler, L. Introductio In Analysin Infinitorum Vol. 2 (MM Bousquet, 1748).
Petkovšek, M., Wilf, H. S. & Zeilberger, D. A = B (A. K. Peters Ltd., 1996).
Bailey, D., Borwein, J. & Girgensohn, R. Experimental evaluation of Euler sums. Exp. Math. 3, 17–30 (1994).
Wang, H. Toward mechanical mathematics. IBM J. Res. Develop. 4, 2–22 (1960).
Lenat, D. B. & Brown, J. S. Why AM and EURISKO appear to work. Artif. Intell. 23, 269–294 (1984).
Lenat, D. B. The nature of heuristics. Artif. Intell. 19, 189–249 (1982).
Davis, R. & Lenat, D. B. KnowledgeBased Systems In Artificial Intelligence (McGrawHill, 1982).
Fajtlowicz, S. On conjectures of Graffiti. In Annals of Discrete Mathematics Vol. 38, 113–118 (Elsevier, 1988).
Alessandretti, L., Baronchelli, A. & He, Y.H. Machine learning meets number theory: the data science of Birch–SwinnertonDyer. Preprint at https://arxiv.org/abs/1911.02008 (2019).
Chen, W. Y., Hou, Q. H. & Zeilberger, D. Automated discovery and proof of congruence theorems for partial sums of combinatorial sequences. J. Diff. Equ. Appl. 22, 780–788 (2016).
Buchberger, B. et al. Theorema: towards computeraided mathematical theory exploration. J. Appl. Log. 4, 470–504 (2006).
Ferguson, H., Bailey, D. & Arno, S. Analysis of PSLQ, an integer relation finding algorithm. Math. Comput. Am. Math. Soc. 68, 351–369 (1999).
Bailey, D., Borwein, P. & Plouffe, S. On the rapid computation of various polylogarithmic constants. Math. Comput. Am. Math. Soc. 66, 903–913 (1997).
Bailey, D. & Broadhurst, D. J. Parallel integer relation detection: techniques and applications. Math. Comput. 70, 1719–1737 (2000).
Wolfram, S. A New Kind Of Science Vol. 5 (Wolfram Media, 2002).
Schmidt, M. & Lipson, H. Distilling freeform natural laws from experimental data. Science 324, 81–85 (2009).
He, Y.H. Deeplearning the landscape. Preprint at https://arxiv.org/abs/1706.02714 (2017).
Wu, T. & Tegmark, M. Toward an artificial intelligence physicist for unsupervised learning. Phys. Rev. E 100, 033311 (2019).
Greydanus, S., Dzamba, M. & Yosinski, J. Hamiltonian neural networks. In Advances in Neural Information Processing Systems (NEURIPS2019) Vol. 32, 15379−15389 (2019).
Iten, R., Metger, T., Wilming, H., del Rio, L. & Renner, R. Discovering physical concepts with neural networks. Phys. Rev. Lett. 124, 010508 (2020).
Udrescu, S. & Tegmark, M. AI Feynman: a physicsinspired method for symbolic regression. Sci. Adv. 6, eaay2631 (2020).
Wiles, A. Modular elliptic curves and Fermat’s last theorem. Ann. Math. 141, 443–551 (1995).
Smale, S. Mathematical problems for the next century. Math. Intell. 20, 7–15 (1998).
Van der Poorten, A. & Apéry, R. A proof that Euler missed…. Math. Intell. 1, 195–203 (1979).
Borwein, J., Borwein, P. & Bailey, D. Ramanujan, modular equations, and approximations to pi or how to compute one billion digits of pi. Am. Math. Mon. 96, 201–219 (1989).
Pilehrood, K. H. & Pilehrood, T. H. Series acceleration formulas for beta values. Discret. Math. Theor. Comput. Sci. 12, 223–236 (2010).
Kim, S. Normality analysis of current world record computations for Catalan’s constant and arc length of a lemniscate with a = 1. Preprint at https://arxiv.org/abs/1908.08925 (2019).
Nesterenko, Y. V. On Catalan’s constant. Proc. Steklov Inst. Math. 292, 153–170 (2016).
Zudilin, W. Wellpoised hypergeometric service for diophantine problems of zeta values. J. Théor. Nomb. Bordeaux 15, 593–626 (2003).
Zudilin, W. One of the odd zeta values from ζ(5) to ζ(25) is irrational. By elementary means. Symmetry Integr. Geom. 14, 028 (2018).
Raayoni, G. et al. The Ramanujan machine: automatically generated conjectures on fundamental constants. Preprint at https://arxiv.org/abs/1907.00205 (2019).
DoughertyBliss, R. & Zeilberger, D. Automatic conjecturing and proving of exact values of some infinite families of infinite continued fractions. Preprint at https://arxiv.org/abs/2004.00090 (2020).
Tshitoyan, V. et al. Unsupervised word embeddings capture latent knowledge from materials science literature. Nature 571, 95–98 (2019).
Zudilin, W. A thirdorder Apérylike recursion for ζ(5). Mathematical Notes [Mat. Zametki] 72, 733–737 [796–800] (2002).
Rivoal, T. Rational approximations for values of derivatives of the Gamma function. Trans. Am. Math. Soc. 361, 6115–6149 (2009).
Acknowledgements
We thank M. Soljačić, B. Weiss, D. Soudry and D. Carmon for helpful discussions. I.K. is grateful for the support of R. Magid and B. Magid and for the support of the Azrieli Faculty Fellowship. Y.M. acknowledges the support and guidance of the Israeli Alpha Program for Excellent HighSchool Students.
Author information
Authors and Affiliations
Contributions
G.R., G.P. and I.K. implemented the first proofofconcept algorithms. G.R. implemented the first generation MITMRF algorithm. S.G. and Y. Harris implemented the stateoftheart MITMRF algorithm. S.G. made the developments that led to the discovery of the ζ(3) and Catalan PCFs. Y.M. implemented the Descent&Repel algorithm. Y.M., S.G., U.M. and I.K found how to convert the Catalan PCFs into expressions with record approximation exponents and fast convergence rates. U.M., Y.M., G.R., S.G., Y. Harris and I.K. proposed parts of the algorithms and developed proofs for some of the conjectures. D.H. and Y. Hadad developed the online community. Y. Hadad, G.P. and I.K. came up with the conceptual flow of the wider concept. I.K. conceived the idea and led the research. All authors provided substantial input to all aspects of the project and to the writing of the paper.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Peer review information Nature thanks YangHui He, Doron Zeilberger and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Peer reviewer reports are available.
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Extended data figures and tables
Extended Data Fig. 1 Convergence rates of the PCFs.
The plots present the absolute difference between the PCF value and the corresponding fundamental constant (that is, the error) versus the number of terms calculated in the PCF. On the left are PCFs with exponential/superexponential convergence rates, and on the right are PCFs that converge polynomially. The majority of previously known PCFs for π converge polynomially, whereas all of our newly found results converge exponentially.
Supplementary information
Supplementary Information
This file contains Supplementary Sections A–G, 6 Supplementary Tables, and a Supplementary Figure. The first section provides the results found by the Ramanujan Machine algorithms. The last section provides the new findings about the Catalan constant.
Rights and permissions
About this article
Cite this article
Raayoni, G., Gottlieb, S., Manor, Y. et al. Generating conjectures on fundamental constants with the Ramanujan Machine. Nature 590, 67–73 (2021). https://doi.org/10.1038/s41586021032294
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1038/s41586021032294
 Springer Nature Limited
This article is cited by

Why mathematics is set to be revolutionized by AI
Nature (2024)

On the Connection Between Irrationality Measures and Polynomial Continued Fractions
Arnold Mathematical Journal (2024)

On scientific understanding with artificial intelligence
Nature Reviews Physics (2022)

A Note on the Remarkable Expression of the Number \({8}/{\pi ^2}\) That the Ramanujan Machine Discovered
The Mathematical Intelligencer (2022)