Documented by Paolo Borghi — Verified computationally (2025)
The Borghi Polynomial is a cubic integer polynomial that produces a run of
29 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 = 29
making it one of the longest documented prime-generating runs for a monic cubic polynomial.
Let
f(n) = n³ − 35n² + 308n + 73.
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 = 29
i.e. |f(n)| is prime for all n = 0, 1, 2, …, 28, and the first
composite value occurs at n = 29.
The table below lists the 29 consecutive prime values produced by
f(n) = n³ − 35n² + 308n + 73 for integers
n = 0, 1, …, 28.
| n | f(n) | is prime |
|---|---|---|
| 0 | 73 | ✔ |
| 1 | 347 | ✔ |
| 2 | 557 | ✔ |
| 3 | 709 | ✔ |
| 4 | 809 | ✔ |
| 5 | 863 | ✔ |
| 6 | 877 | ✔ |
| 7 | 857 | ✔ |
| 8 | 809 | ✔ |
| 9 | 739 | ✔ |
| 10 | 653 | ✔ |
| 11 | 557 | ✔ |
| 12 | 457 | ✔ |
| 13 | 359 | ✔ |
| 14 | 269 | ✔ |
| 15 | 193 | ✔ |
| 16 | 137 | ✔ |
| 17 | 107 | ✔ |
| 18 | 109 | ✔ |
| 19 | 149 | ✔ |
| 20 | 233 | ✔ |
| 21 | 367 | ✔ |
| 22 | 557 | ✔ |
| 23 | 809 | ✔ |
| 24 | 1129 | ✔ |
| 25 | 1523 | ✔ |
| 26 | 1997 | ✔ |
| 27 | 2557 | ✔ |
| 28 | 3209 | ✔ |
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 and can be reproduced on standard hardware in a fraction of a second.
Any reader can verify the run length with the following code:
Test di primalità per la terzina "regina" cubica monica:
f(n) = n^3 - 35 n^2 + 308 n + 73
Lo script:
- calcola f(n) per n = 0, 1, 2, ...
- verifica se f(n) è primo
- si ferma al primo composito
- stampa tutti i valori primi trovati e la lunghezza L
"""
# Coefficienti della terzina regina
A = -35
B = 308
C = 73
def is_prime(n: int) -> bool:
"""Ritorna True se n è primo, False altrimenti (test deterministico per n 'normali')."""
if n < 2:
return False
if n % 2 == 0:
return n == 2
# prova i divisori dispari fino alla radice quadrata
d = 3
while d * d <= n:
if n % d == 0:
return False
d += 2
return True
def f(n: int) -> int:
"""Polinomio cubico monico f(n) = n^3 + A n^2 + B n + C."""
return n**3 + A*n**2 + B*n + C
def main():
primi = []
n = 0
while True:
v = f(n)
if v < 2 or not is_prime(v):
# abbiamo trovato il primo composito: interrompiamo
break
primi.append((n, v))
n += 1
L = len(primi)
print("Terzina regina:")
print(f" (a, b, c) = ({A}, {B}, {C})")
print("\nValori primi generati a partire da n = 0:\n")
for n_val, p_val in primi:
print(f"n = {n_val:2d} -> f(n) = {p_val}")
print("\nLunghezza della sequenza di primi consecutivi (L):", L)
# Mostra anche il primo composito subito dopo la sequenza
v_comp = f(L)
print(f"\nPrimo valore composito dopo la sequenza:")
print(f"n = {L} -> f(n) = {v_comp}")
if __name__ == "__main__":
main()
Running this program will output Run length L = 29, confirming
the claimed record.
Suggested citation (APA-style):
Borghi, P. (2025). A Prime-Generating Monic Cubic Polynomial
with Run Length L = 29. Zenodo. https://zenodo.org/records/17844166
Paolo Borghi
Independent researcher in number theory and prime-generating polynomials.
paolo.borghi@gmail.com