A Compact Closed-Form Approximation for the n-th Prime in Digital Root Classes Modulo 9: Implementation and Benchmark
We present a compact closed-form approximation for the n-th prime p(a) n in a fixedreduced residue class a (mod 9) (a ∈ {1, 2, 4, 5, 7, 8}). The expression is built from the Cipolla–Bach–Shallit asymptotic expansion of pn truncated at order L−3 (whose coefficients are theoretically exact and not fitted), augmented by a linear correction at order L−4 and a Chebyshev-bias correction of order √c/L, both with empirically calibrated coefficients.Calibration is performed by weighted linear least squares on 294 samples in the range n ∈ [100, 106], giving four free parameters total. The resulting estimator achieves global RMS relative error of 0.057% on a validation set of ∼ 6 × 106 samples, falling below 0.04% for n ≥ 105 across all six residue classes.We make no novel theoretical claims: every analytical ingredient of the formula appears in the prior literature (Cipolla 1902, Bach–Shallit 1996, Dusart 2010, Axler 2017 for the asymptotic expansion; Rubinstein–Sarnak 1994, Granville–Martin 2006 for the Chebyshev bias). The contribution of this paper is purely computational: a single explicit expression that is convenient to evaluate, an honest benchmark against exact prime data, and a self-contained pure-Python reference implementation suitable as a teaching example or as a fast subroutine in algorithmic applications.
Authors
- Giovanni Ferraiuolo
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-05-11
- DOI
- https://doi.org/10.5281/zenodo.20126879
- Primary Topic
- Analytic Number Theory Research
- Type
- preprint