Skip to main content

Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

  • Article
  • Published:

Generating conjectures on fundamental constants with the Ramanujan Machine

Abstract

Fundamental mathematical constants such as e and π are ubiquitous in diverse fields of science, from abstract mathematics and geometry to physics, biology and chemistry1,2. Nevertheless, for centuries new mathematical formulas relating fundamental constants have been scarce and usually discovered sporadically3,4,5,6. Such discoveries are often considered an act of mathematical ingenuity or profound intuition by great mathematicians such as Gauss and Ramanujan7. 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 meet-in-the-middle 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 proving8,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.

This is a preview of subscription content, access via your institution

Access options

Buy this article

Prices may be subject to local taxes which are calculated during checkout

Fig. 1: Conceptual flow of the wider concept of the Ramanujan Machine.
Fig. 2: The Meet-In-The-Middle Regular Formula algorithm.
Fig. 3: The Descent&Repel algorithm.
Fig. 4: Efficient computation of the Catalan constant with new PCFs.

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

  1. Finch, S. Mathematical Constants (Cambridge Univ. Press, 2003).

  2. Bailey, D., Plouffe, S. M., Borwein, P. & Borwein, J. The quest for pi. Math. Intell. 19, 50–56 (1997).

    Article  MathSciNet  Google Scholar 

  3. Apéry, R. Irrationalité de ζ(2) et ζ(3). Asterisque 61, 11–13 (1979).

    Google Scholar 

  4. Zeilberger, D. & Zudilin, W. The irrationality measure of pi is at most 7.103205334137…. Moscow J. Combin. Number. Theory 9, 407–419 (2019).

    Article  Google Scholar 

  5. Zudilin, W. An Apéry-like difference equation for Catalan’s constant. J. Combin. 10, R14 (2003).

    Article  Google Scholar 

  6. Hardy, G. H. & Wright, E. M. An Introduction to the Theory of Numbers 5th edn (Oxford Univ. Press, 1980).

  7. Berndt, B. C. Ramanujan’s Notebooks (Springer Science & Business Media, 2012).

  8. Appel, K. I. & Haken, W. Every Planar Map Is Four Colorable Vol. 98 (American Mathematical Society, 1989).

  9. Wilf, H. S. & Zeilberger, D. Rational functions certify combinatorial identities. J. Am. Math. Soc. 3, 147–158 (1990).

    Article  MathSciNet  Google Scholar 

  10. McCune, W. Solution of the Robbins problem. J. Autom. Reason. 19, 263–276 (1997).

    Article  MathSciNet  Google Scholar 

  11. Hales, T. C. A proof of the Kepler conjecture. Ann. Math. 162, 1065–1185 (2005).

    Article  MathSciNet  Google Scholar 

  12. Lample, G. & Charton, F. Deep learning for symbolic mathematics. In ICLR Conf. https://openreview.net/forum?id=S1eZYeHFDS (2020).

  13. Cranmer, M. et al. Discovering symbolic models from deep learning with inductive biases. Preprint at https://arxiv.org/abs/2006.11287 (2020).

  14. Turing, A. M. On computable numbers, with an application to the Entscheidungsproblem. Proc. Lond. Math. Soc. s2-42, 230–265 (1937).

    Article  MathSciNet  Google Scholar 

  15. Asimov, I. & Shulman, J. A. Isaac Asimov’s Book of Science and Nature Quotations (Weidenfeld & Nicolson, 1988).

  16. Bohr, N. Rydberg’s Discovery Of The Spectral Laws (C.W.K. Gleerup, 1954).

  17. Shimura, G. Modular forms of half integral weight. In Modular Functions of One Variable I 57–74 (Springer, 1973).

  18. Cuyt, A. A., Petersen, V., Verdonk, B., Waadeland, H. & Jones, W. B. Handbook Of Continued Fractions For Special Functions (Springer Science & Business Media, 2008).

  19. Scott, J. F. The Mathematical Work Of John Wallis (1616–1703) (Taylor and Francis, 1938).

  20. Bowman, D. & Laughlin, J. M. Polynomial continued fractions. Acta Arith. 103, 329–342 (2002).

    Article  ADS  MathSciNet  Google Scholar 

  21. McLaughlin, J. M. & Wyshinski, N. J. Real numbers with polynomial continued fraction expansions. Acta Arith. 116, 63–79 (2005).

    Article  ADS  MathSciNet  Google Scholar 

  22. Press, W. H. Seemingly Remarkable Mathematical Coincidences Are Easy To Generate (Univ. Texas, 2009).

  23. Euler, L. Introductio In Analysin Infinitorum Vol. 2 (MM Bousquet, 1748).

  24. Petkovšek, M., Wilf, H. S. & Zeilberger, D. A = B (A. K. Peters Ltd., 1996).

  25. Bailey, D., Borwein, J. & Girgensohn, R. Experimental evaluation of Euler sums. Exp. Math. 3, 17–30 (1994).

    Article  MathSciNet  Google Scholar 

  26. Wang, H. Toward mechanical mathematics. IBM J. Res. Develop. 4, 2–22 (1960).

    Article  MathSciNet  Google Scholar 

  27. Lenat, D. B. & Brown, J. S. Why AM and EURISKO appear to work. Artif. Intell. 23, 269–294 (1984).

    Article  Google Scholar 

  28. Lenat, D. B. The nature of heuristics. Artif. Intell. 19, 189–249 (1982).

    Article  Google Scholar 

  29. Davis, R. & Lenat, D. B. Knowledge-Based Systems In Artificial Intelligence (McGraw-Hill, 1982).

  30. Fajtlowicz, S. On conjectures of Graffiti. In Annals of Discrete Mathematics Vol. 38, 113–118 (Elsevier, 1988).

  31. Alessandretti, L., Baronchelli, A. & He, Y.-H. Machine learning meets number theory: the data science of Birch–Swinnerton-Dyer. Preprint at https://arxiv.org/abs/1911.02008 (2019).

  32. 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).

    Article  MathSciNet  Google Scholar 

  33. Buchberger, B. et al. Theorema: towards computer-aided mathematical theory exploration. J. Appl. Log. 4, 470–504 (2006).

    Article  MathSciNet  Google Scholar 

  34. Ferguson, H., Bailey, D. & Arno, S. Analysis of PSLQ, an integer relation finding algorithm. Math. Comput. Am. Math. Soc. 68, 351–369 (1999).

    Article  ADS  MathSciNet  Google Scholar 

  35. Bailey, D., Borwein, P. & Plouffe, S. On the rapid computation of various polylogarithmic constants. Math. Comput. Am. Math. Soc. 66, 903–913 (1997).

    Article  ADS  MathSciNet  Google Scholar 

  36. Bailey, D. & Broadhurst, D. J. Parallel integer relation detection: techniques and applications. Math. Comput. 70, 1719–1737 (2000).

    Article  ADS  MathSciNet  Google Scholar 

  37. Wolfram, S. A New Kind Of Science Vol. 5 (Wolfram Media, 2002).

  38. Schmidt, M. & Lipson, H. Distilling free-form natural laws from experimental data. Science 324, 81–85 (2009).

    Article  ADS  CAS  Google Scholar 

  39. He, Y.-H. Deep-learning the landscape. Preprint at https://arxiv.org/abs/1706.02714 (2017).

  40. Wu, T. & Tegmark, M. Toward an artificial intelligence physicist for unsupervised learning. Phys. Rev. E 100, 033311 (2019).

    Article  ADS  CAS  Google Scholar 

  41. Greydanus, S., Dzamba, M. & Yosinski, J. Hamiltonian neural networks. In Advances in Neural Information Processing Systems (NEURIPS2019) Vol. 32, 15379−15389 (2019).

  42. Iten, R., Metger, T., Wilming, H., del Rio, L. & Renner, R. Discovering physical concepts with neural networks. Phys. Rev. Lett. 124, 010508 (2020).

    Article  ADS  CAS  Google Scholar 

  43. Udrescu, S. & Tegmark, M. AI Feynman: a physics-inspired method for symbolic regression. Sci. Adv. 6, eaay2631 (2020).

    Article  ADS  Google Scholar 

  44. Wiles, A. Modular elliptic curves and Fermat’s last theorem. Ann. Math. 141, 443–551 (1995).

    Article  MathSciNet  Google Scholar 

  45. Smale, S. Mathematical problems for the next century. Math. Intell. 20, 7–15 (1998).

    Article  MathSciNet  Google Scholar 

  46. Van der Poorten, A. & Apéry, R. A proof that Euler missed…. Math. Intell. 1, 195–203 (1979).

    Article  Google Scholar 

  47. 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).

    Article  MathSciNet  Google Scholar 

  48. Pilehrood, K. H. & Pilehrood, T. H. Series acceleration formulas for beta values. Discret. Math. Theor. Comput. Sci. 12, 223–236 (2010).

    MathSciNet  MATH  Google Scholar 

  49. 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).

  50. Nesterenko, Y. V. On Catalan’s constant. Proc. Steklov Inst. Math. 292, 153–170 (2016).

    Article  MathSciNet  Google Scholar 

  51. Zudilin, W. Well-poised hypergeometric service for diophantine problems of zeta values. J. Théor. Nomb. Bordeaux 15, 593–626 (2003).

    Article  MathSciNet  Google Scholar 

  52. Zudilin, W. One of the odd zeta values from ζ(5) to ζ(25) is irrational. By elementary means. Symmetry Integr. Geom. 14, 028 (2018).

  53. Raayoni, G. et al. The Ramanujan machine: automatically generated conjectures on fundamental constants. Preprint at https://arxiv.org/abs/1907.00205 (2019).

  54. Dougherty-Bliss, 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).

  55. Tshitoyan, V. et al. Unsupervised word embeddings capture latent knowledge from materials science literature. Nature 571, 95–98 (2019).

    Article  ADS  CAS  Google Scholar 

  56. Zudilin, W. A third-order Apéry-like recursion for ζ(5). Mathematical Notes [Mat. Zametki] 72, 733–737 [796–800] (2002).

    Article  Google Scholar 

  57. Rivoal, T. Rational approximations for values of derivatives of the Gamma function. Trans. Am. Math. Soc. 361, 6115–6149 (2009).

    Article  MathSciNet  Google Scholar 

Download references

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 High-School Students.

Author information

Authors and Affiliations

Authors

Contributions

G.R., G.P. and I.K. implemented the first proof-of-concept algorithms. G.R. implemented the first generation MITM-RF algorithm. S.G. and Y. Harris implemented the state-of-the-art MITM-RF 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

Correspondence to Ido Kaminer.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Peer review information Nature thanks Yang-Hui 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/super-exponential 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.

Extended Data Table 1 RFs for π and e found in a proof-of-concept run of the Descent&Repel algorithm

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.

Peer Review File

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

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/s41586-021-03229-4

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1038/s41586-021-03229-4

This article is cited by

Comments

By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.

Search

Quick links

Nature Briefing AI and Robotics

Sign up for the Nature Briefing: AI and Robotics newsletter — what matters in AI and robotics research, free to your inbox weekly.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing: AI and Robotics