Documented by Paolo Borghi — Verified computationally (2025)
The Borghi Polynomial is a cubic integer polynomial that produces a run of
30 consecutive prime values when evaluated at
consecutive integers starting at n = 0. As usual in this context,
primality is tested on the absolute value |f(n)|.
The polynomial
is a monic cubic polynomial, since the leading coefficient (the
coefficient of n³) is equal to 1.
This places it within the class of
monic cubic prime-generating polynomials, a mathematically
significant and more restrictive family compared to non-monic cubic polynomials.
In this stricter category, achieving a long consecutive prime run is notably difficult. The Borghi Polynomial attains a run length of:
L = 30
making it one of the longest documented prime-generating runs for a monic cubic polynomial.
Let
f(n) = n³ + 23n² − 1988n + 24223.
Define the run length L as the largest integer such that
|f(n)| is prime for all integers n with
0 ≤ n ≤ L − 1.
For the Borghi Polynomial we have:
L = 30
i.e. |f(n)| is prime for all n = 0, 1, 2, …, 29, and the first
composite value occurs at n = 30.
The table below lists the 30 consecutive prime values produced by
f(n) = n³ + 23n² − 1988n + 24223 for integers
n = 0, 1, …, 29.
| n | f(n) | is prime |
|---|---|---|
| 0 | 24223 | ✔ |
| 1 | 22259 | ✔ |
| 2 | 20347 | ✔ |
| 3 | 18493 | ✔ |
| 4 | 16703 | ✔ |
| 5 | 14983 | ✔ |
| 6 | 13339 | ✔ |
| 7 | 11777 | ✔ |
| 8 | 10303 | ✔ |
| 9 | 8923 | ✔ |
| 10 | 7643 | ✔ |
| 11 | 6469 | ✔ |
| 12 | 5407 | ✔ |
| 13 | 4463 | ✔ |
| 14 | 3643 | ✔ |
| 15 | 2953 | ✔ |
| 16 | 2399 | ✔ |
| 17 | 1987 | ✔ |
| 18 | 1723 | ✔ |
| 19 | 1613 | ✔ |
| 20 | 1663 | ✔ |
| 21 | 1879 | ✔ |
| 22 | 2267 | ✔ |
| 23 | 2833 | ✔ |
| 24 | 3583 | ✔ |
| 25 | 4523 | ✔ |
| 26 | 5659 | ✔ |
| 27 | 6997 | ✔ |
| 28 | 8543 | ✔ |
| 29 | 10303 | ✔ |
The record was established by exhaustive evaluation of f(n) for
consecutive integers and deterministic primality tests up to the first
composite value. No probabilistic methods (e.g. Miller–Rabin with bases)
were needed for this range; simple trial division up to sqrt(x) is sufficient.
The computation is lightweight for verifying a single polynomial and can be reproduced on standard hardware in a fraction of a second.
Any reader can verify the run length with the following code:
"""
Deterministic primality test for the monic cubic record:
f(n) = n^3 + 23 n^2 - 1988 n + 24223
The script:
- computes f(n) for n = 0, 1, 2, ...
- checks whether f(n) is prime
- stops at the first composite value
- prints all prime values and the run length L
"""
# Coefficients of the record triple
A = 23
B = -1988
C = 24223
def is_prime(n: int) -> bool:
"""Return True if n is prime, False otherwise (deterministic for this range)."""
if n < 2:
return False
if n % 2 == 0:
return n == 2
d = 3
while d * d <= n:
if n % d == 0:
return False
d += 2
return True
def f(n: int) -> int:
"""Monic cubic polynomial f(n) = n^3 + A n^2 + B n + C."""
return n**3 + A*n**2 + B*n + C
def main():
primes = []
n = 0
while True:
v = f(n)
if v < 2 or not is_prime(v):
break
primes.append((n, v))
n += 1
L = len(primes)
print("Record triple:")
print(f" (a, b, c) = ({A}, {B}, {C})")
print("\nPrime values generated starting from n = 0:\n")
for n_val, p_val in primes:
print(f"n = {n_val:2d} -> f(n) = {p_val}")
print("\nLength of the consecutive prime run (L):", L)
v_comp = f(L)
print(f"\nFirst composite value after the run:")
print(f"n = {L} -> f(n) = {v_comp}")
if __name__ == "__main__":
main()
Running this program will output Run length L = 30, confirming
the claimed record.
Suggested citation (APA-style):
Borghi, P. (2025). A Prime-Generating Monic Cubic Polynomial
with Run Length L = 30. Zenodo. https://doi.org/10.5281/zenodo.17857524
Paolo Borghi
Independent researcher in number theory and prime-generating polynomials.
paolo.borghi@gmail.com