Skip to main content

Thank you for visiting 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.

Generating conjectures on fundamental constants with the Ramanujan Machine


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.

Access options

Rent or Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

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.

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: and the GitHub links therein.


  1. 1.

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

  2. 2.

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

    MathSciNet  Article  Google Scholar 

  3. 3.

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

    Google Scholar 

  4. 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. 5.

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

    Article  Google Scholar 

  6. 6.

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

  7. 7.

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

  8. 8.

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

  9. 9.

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

    MathSciNet  Article  Google Scholar 

  10. 10.

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

    MathSciNet  Article  Google Scholar 

  11. 11.

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

    MathSciNet  Article  Google Scholar 

  12. 12.

    Lample, G. & Charton, F. Deep learning for symbolic mathematics. In ICLR Conf. (2020).

  13. 13.

    Cranmer, M. et al. Discovering symbolic models from deep learning with inductive biases. Preprint at (2020).

  14. 14.

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

    MathSciNet  Article  Google Scholar 

  15. 15.

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

  16. 16.

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

  17. 17.

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

  18. 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. 19.

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

  20. 20.

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

    ADS  MathSciNet  Article  Google Scholar 

  21. 21.

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

    ADS  MathSciNet  Article  Google Scholar 

  22. 22.

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

  23. 23.

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

  24. 24.

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

  25. 25.

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

    MathSciNet  Article  Google Scholar 

  26. 26.

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

    MathSciNet  Article  Google Scholar 

  27. 27.

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

    Article  Google Scholar 

  28. 28.

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

    Article  Google Scholar 

  29. 29.

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

  30. 30.

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

  31. 31.

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

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

    MathSciNet  Article  Google Scholar 

  33. 33.

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

    MathSciNet  Article  Google Scholar 

  34. 34.

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

    ADS  MathSciNet  Article  Google Scholar 

  35. 35.

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

    ADS  MathSciNet  Article  Google Scholar 

  36. 36.

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

    ADS  MathSciNet  Article  Google Scholar 

  37. 37.

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

  38. 38.

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

    ADS  CAS  Article  Google Scholar 

  39. 39.

    He, Y.-H. Deep-learning the landscape. Preprint at (2017).

  40. 40.

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

    ADS  CAS  Article  Google Scholar 

  41. 41.

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

  42. 42.

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

    ADS  CAS  Article  Google Scholar 

  43. 43.

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

    ADS  Article  Google Scholar 

  44. 44.

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

    MathSciNet  Article  Google Scholar 

  45. 45.

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

    MathSciNet  Article  Google Scholar 

  46. 46.

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

    Article  Google Scholar 

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

    MathSciNet  Article  Google Scholar 

  48. 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. 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 (2019).

  50. 50.

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

    MathSciNet  Article  Google Scholar 

  51. 51.

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

    MathSciNet  Article  Google Scholar 

  52. 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. 53.

    Raayoni, G. et al. The Ramanujan machine: automatically generated conjectures on fundamental constants. Preprint at (2019).

  54. 54.

    Dougherty-Bliss, R. & Zeilberger, D. Automatic conjecturing and proving of exact values of some infinite families of infinite continued fractions. Preprint at (2020).

  55. 55.

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

    ADS  CAS  Article  Google Scholar 

  56. 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. 57.

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

    MathSciNet  Article  Google Scholar 

Download references


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




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

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

Download citation

Further reading


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.


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

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