Computing $\pi(N)$: An elementary approach in $\tilde{O}(\sqrt{N})$ time
Dean Hirsch, Ido Kessler, Uri Mendlovic

TL;DR
This paper introduces an elementary, efficient algorithm for counting primes up to N in near square-root time, surpassing previous combinatorial methods and offering space-time trade-offs, with applications to other number-theoretic functions.
Contribution
The authors develop a new elementary algorithm for prime counting with improved time complexity and space trade-offs, avoiding complex analysis and arbitrary precision calculations.
Findings
Achieves rom ilde{O}(\sqrt{N}) ext{ to } ilde{O}( ext{N}^{8/15}) ext{ space-time trade-off}
Improves complexity for computing the Mertens function to ilde{O}(\sqrt{N})
Provides implementation code for practical use
Abstract
We present an efficient and elementary algorithm for computing the number of primes up to in time, improving upon the existing combinatorial methods that require time. Our method has a similar time complexity to the analytical approach to prime counting, while avoiding complex analysis and the use of arbitrary precision complex numbers. While the most time-efficient version of our algorithm requires space, we present a continuous space-time trade-off, showing, e.g., how to reduce the space complexity to while slightly increasing the time complexity to . We apply our techniques to improve the state-of-the-art complexity of elementary algorithms for computing other number-theoretic functions, such as the the Mertens function (in time compared to the known…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNumerical Methods and Algorithms · Computability, Logic, AI Algorithms · History and Theory of Mathematics
