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).\)
Similar content being viewed by others
References
A. M. Legendre, Essai sur la Théorie des Nombres, Courcier, Paris (1808).
C. F. Gauss, Werke, vol. II, Königliche Gesellschaft der Wissenschaften zu Göttingen, 444–447 (1863).
G. F. B. Riemann, “Über die Anzahl der Primzahlen unter einer gegebenen Grösse,” Monatsber. Königl., Preuss Akad. Wiss., Berlin, 671–680 (1859).
G. H. Hardy, Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work, 3rd edn., Chelsea, New York (1999).
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).
E. W. Weisstein, Gram Series; http://mathworld.wolfram.com/GramSeries.html.
A. E. Ingham, The Distribution of Prime Numbers, Cambridge Univ. Press, New York (1990).
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.
D. C. Mapes, “Fast method for computing the number of primes less than a given limit,” Math. Comp., 17, 179–185 (1963).
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.
E. D. F. Meissel, “Berechnung der Menge von Primzahlen, Welche Innerhalb der Ersten Milliarde Naturlicher Zahlen Vorkommen,” Math. Ann., 25, 251–257 (1885).
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.
R. Séroul, “Meissel’s formula,” Programming for Mathematicians, § 8.7.3, Springer-Verlag, Berlin (2000), p. 179–181.
A. V. Kulsha, Values of π(x) and ∆(x) for Various Values of x, retrieved 2008-09-14 (2008).
C.-J. de la Vallée Poussin, “Recherches analytiques la théorie des nombres premiers,” Ann. Soc. Sci. Bruxelles, 20, 183–256 (1896).
L. Locker-Ernst, “Bemerkung über die Verteilung der Primzahlen,” Elem. Math., 14, 1–5 (1959).
L. Panaitopol, “Several approximations of π(x),” Math. Inequal. Appl., 2, 317–324 (1999).
J. Havil, Gamma. Exploring Euler’s constant, Princeton Univ. Press, Princeton, NJ (2003).
C. K. Caldwell, How Many Primes Are There?; https://primes.utm.edu/howmany.htmlbetter.
Author information
Authors and Affiliations
Corresponding author
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.
About this article
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
Received:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11253-023-02145-2