Skip to main content
Log in

New Fast Methods To Compute The Number Of Primes Smaller Than A Given Value

  • Published:
Ukrainian Mathematical Journal Aims and scope

We describe new fast algorithms intended for the evaluation of π(x) inspired by the harmonic and geometric mean integrals that can be used on any pocket calculator. In particular, the formula h(x) based on the harmonic mean is within ≈ 15 of the actual value for 3 ≤ x ≤ 10000. The approximation verifies the inequality h(x) ≤ Li(x) and, therefore, is better than Li(x) for small x. We show that h(x) and their extensions are more accurate than the other famous approximations, such as the Locker–Ernst or Legendre approximations also for large x. In addition, we derive another function g(x) based on the geometric mean integral that employs h(x) as an input and allows one to significantly improve the quality of this method. We show that g(x) is within ≈ 25 of the actual value for x ≤ 50, 000 (to compare, Li(x) lies within ≈ 40 for the same range) and asymptotically \(g\left(x\right)\sim \frac{x}{1\mathrm{n} x}\mathrm{exp}\left(\frac{1}{1\mathrm{n} x-1}\right).\)

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. A. M. Legendre, Essai sur la Théorie des Nombres, Courcier, Paris (1808).

    MATH  Google Scholar 

  2. C. F. Gauss, Werke, vol. II, Königliche Gesellschaft der Wissenschaften zu Göttingen, 444–447 (1863).

  3. G. F. B. Riemann, “Über die Anzahl der Primzahlen unter einer gegebenen Grösse,” Monatsber. Königl., Preuss Akad. Wiss., Berlin, 671–680 (1859).

  4. G. H. Hardy, Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work, 3rd edn., Chelsea, New York (1999).

  5. J. M. Borwein, D. M. Bradley, and R. E. Crandall, “Computational strategies for the Riemann Zeta function,” J. Comput. Appl. Math., 121, 247–296 (2000).

    Article  MathSciNet  MATH  Google Scholar 

  6. E. W. Weisstein, Gram Series; http://mathworld.wolfram.com/GramSeries.html.

  7. A. E. Ingham, The Distribution of Prime Numbers, Cambridge Univ. Press, New York (1990).

    MATH  Google Scholar 

  8. H. Riesel, “Lehmer’s formula,” in: Prime Numbers and Computer Methods for Factorization, 2nd edn. Progr. in Mathematics, Birkhäuser Boston, Inc., Boston, MA (1994), pp. 13–14.

  9. D. C. Mapes, “Fast method for computing the number of primes less than a given limit,” Math. Comp., 17, 179–185 (1963).

    Article  MathSciNet  MATH  Google Scholar 

  10. H. Riesel, “Mapes’ method,” in: Prime Numbers and Computer Methods for Factorization, 2nd edn., Progress in Mathematics, Birkhäuser Boston, Boston, MA (1994), p. 23.

  11. E. D. F. Meissel, “Berechnung der Menge von Primzahlen, Welche Innerhalb der Ersten Milliarde Naturlicher Zahlen Vorkommen,” Math. Ann., 25, 251–257 (1885).

    Article  MathSciNet  MATH  Google Scholar 

  12. H. Riesel, “Meissel’s formula,” in: Prime Numbers and Computer Methods for Factorization, 2nd edn., Progr. in Mathematics, Birkhäuser Boston, Boston, MA (1994), p. 12–13.

  13. R. Séroul, “Meissel’s formula,” Programming for Mathematicians, § 8.7.3, Springer-Verlag, Berlin (2000), p. 179–181.

  14. A. V. Kulsha, Values of π(x) and ∆(x) for Various Values of x, retrieved 2008-09-14 (2008).

  15. C.-J. de la Vallée Poussin, “Recherches analytiques la théorie des nombres premiers,” Ann. Soc. Sci. Bruxelles, 20, 183–256 (1896).

  16. L. Locker-Ernst, “Bemerkung über die Verteilung der Primzahlen,” Elem. Math., 14, 1–5 (1959).

    MathSciNet  Google Scholar 

  17. L. Panaitopol, “Several approximations of π(x),” Math. Inequal. Appl., 2, 317–324 (1999).

    MathSciNet  MATH  Google Scholar 

  18. J. Havil, Gamma. Exploring Euler’s constant, Princeton Univ. Press, Princeton, NJ (2003).

  19. C. K. Caldwell, How Many Primes Are There?; https://primes.utm.edu/howmany.htmlbetter.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to G. R. P. Teruel.

Additional information

Published in Ukrains’kyi Matematychnyi Zhurnal, Vol. 74, No. 9, pp. 1264–1273, September, 2022. Ukrainian DOI: https://doi.org/10.37863/umzh.v74i9.6193.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Teruel, G.R.P. New Fast Methods To Compute The Number Of Primes Smaller Than A Given Value. Ukr Math J 74, 1441–1451 (2023). https://doi.org/10.1007/s11253-023-02145-2

Download citation

  • Received:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11253-023-02145-2

Navigation