Optimization of an Explicit, Deterministic Formula for All Prime Numbers
THE PRIME NUMBER SERIES 30
Optimization of an Explicit, Deterministic Formula for All Prime Numbers
In the present work, an explicit, deterministic formula for the computation of prime numbers is further developed and algorithmically optimized. The starting point is an exact mathematical construction whose internal structure remains unchanged, while its practical evaluability is decisively improved.
In Contribution 29, the same exact prime formula was presented using empirical bounds. For that version, the guaranteed validity is formally restricted to
![]()
The mathematical core of the formula is entirely correct; the restriction concerns exclusively the choice of the bounds employed.
In the present contribution, only proven explicit bounds are used. As a result, the same formula becomes a fully guaranteed computational rule for the i-th prime number pip_i, valid for all natural numbers i>2i > 2.
Explicit Prime Formula (Optimized Form)
An explicit formula for the i-th prime number is given by
![Rendered by QuickLaTeX.com \[ p_i = 2m(i)-1 + 2\sum_{n_{\max}=m(i)-2}^{u(i)} \left\lfloor \left( \frac{i}{\pi(1,n_{\max})+3} \right)^{1/i} \right\rfloor, \]](https://dieprimzahlenserie.com/wp-content/ql-cache/quicklatex.com-0762906bef68b94ecaa4e0a67fe435b8_l3.png)
valid for
and
,
where
![]()
are assumed as known.
Explicit Bounds and Their Origin
For practical evaluation, functions m(i)m(i) and u(i)u(i) are used such that always
![]()
Lower Bound (Dusart, 2010)
For all
, the proven estimate holds:
![]()
and for all
, the sharpened estimate holds:
![]()
From these estimates, an integer index function
is defined. It does not represent a prime index, but rather the index of an odd candidate of the form
that is guaranteed to lie to the left of
:
![Rendered by QuickLaTeX.com \[ m(i)= \begin{cases} 2, & i=3,\\ 3, & i=4,\\ 5, & i=5,\\[6pt] \left\lfloor \dfrac12\,i(\ln i+\ln\ln i-1) \right\rfloor, & 6\le i<688\,383,\\[10pt] \left\lfloor \dfrac12\,i\left( \ln i+\ln\ln i-1+\dfrac{\ln\ln i-2.1}{\ln i} \right) \right\rfloor, & i\ge688\,383. \end{cases} \]](https://dieprimzahlenserie.com/wp-content/ql-cache/quicklatex.com-16398b5a6b568965fa6f5a861ea5c5d3_l3.png)
Thus, for all
, it always holds that
![]()
Upper Bound (Axler, 2017/2019)
For sufficiently large
, the proven estimate holds:
![]()
From this, we set
![]()
Algorithmic Optimization
The inner sum of the formula is evaluated incrementally. The outer summation can be terminated as soon as the integer summand first becomes zero, which is equivalent to the condition
.
The first zero position
nmax=min{n:π(1,n)+3>i}n_{\max}=\min\{n:\pi(1,n)+3>i\}
![]()
liefert direkt
![]()
Numerical Validation and Scaling Behavior
The computations were performed in wxMaxima on an
HP Pavilion Laptop 15-cs2xxx.
![Rendered by QuickLaTeX.com \[ \begin{alignedat}{4} i=10^2 \;&:\quad & p_i &= 541, \quad & \text{Laufzeit }&0.03\,\mathrm{s}, \quad & \text{Speicher }&4.7\,\mathrm{MB} \\[2pt] i=10^3 \;&:\quad & p_i &= 7919, \quad & \text{Laufzeit }&0.72\,\mathrm{s}, \quad & \text{Speicher }&120\,\mathrm{MB} \\[2pt] i=10^4 \;&:\quad & p_i &= 104729, \quad & \text{Laufzeit }&20.3\,\mathrm{s}, \quad & \text{Speicher }&4.0\,\mathrm{GB} \\[2pt] i=10^5 \;&:\quad & p_i &= 1299709, \quad & \text{Laufzeit }&732\,\mathrm{s}, \quad & \text{Speicher }&132\,\mathrm{GB} \\[6pt] i=10^6 \;&:\quad & p_i &= 15\,485\,863, \quad & \text{Laufzeit }&26\,600\,\mathrm{s}, \quad & \text{Speicher }&4.5\,\mathrm{TB} \end{alignedat} \]](https://dieprimzahlenserie.com/wp-content/ql-cache/quicklatex.com-dddb8e8c12b857b4e4c1774921409574_l3.png)
The millionth prime number
![]()
agrees exactly with the known reference value. This numerically confirms the formal correctness of the optimized explicit prime formula even for large indices.
Conclusion
The present work shows that an exact, deterministic prime formula can be made formally correct and applicable up to large indices through the use of proven bounds and an incremental evaluation strategy. The substantial computational effort underscores the conceptual character of the construction as an explicit mathematical description of the prime sequence, rather than as a practically efficient high-performance method.
Munich, December 23, 2025
Gottfried Färberböck

