n_prime_pi, n_prime_pi_bounds
Synopsis
#include <flint/ulong_extras.h>n_prime_pi looks up small n in a table; otherwise it extends the table of cached primes and performs a binary search.
n_prime_pi_bounds looks up small values in a table and otherwise uses the bounds n / \ln n < \pi(n) < 1.25506\, n / \ln n of Rosser and Schoenfeld [RosSch1962], valid for n \ge 17. The bit length of n is used to bound \ln n from the appropriate side. If lo and hi point to the same location, the upper bound is stored.
References#
- [RosSch1962] Rosser, J. Barkley; Schoenfeld, Lowell: Approximate formulas for some functions of prime numbers. Illinois J. Math. 6 (1962), no. 1, 64–94.
Cite this page
The FLINT team, “n_prime_pi, n_prime_pi_bounds (ulong_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ulong_extras/n_prime_pi.html (generated 2026-10-20).
@misc{flint-doc-ulong-extras-n-prime-pi,
author = {{The FLINT team}},
title = {{n\_prime\_pi, n\_prime\_pi\_bounds (ulong\_extras.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/ulong_extras/n_prime_pi.html},
note = {Generated 2026-10-20}
}