Prime-generating polynomial · Official record

Polynomial (L = 29)

A Prime-Generating Monic Cubic Polynomial

Documented by Paolo Borghi — Verified computationally (2025)

The polynomial

f(n) = n³ − 35n² + 308n + 73

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)|.

Category: monic cubic prime-generating polynomial

The polynomial

f(n) = n³ − 35n² + 308n + 73

is a monic cubic polynomial, since the leading coefficient (the coefficient of ) 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.

Formal statement of the record

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.

Prime values for 0 ≤ n ≤ 28

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
073
1347
2557
3709
4809
5863
6877
7857
8809
9739
10653
11557
12457
13359
14269
15193
16137
17107
18109
19149
20233
21367
22557
23809
241129
251523
261997
272557
283209

Computational verification (sketch)

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.

Reproducibility: minimal Python snippet

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.

Record summary

  • Name Borghi Polynomial
  • Degree 3 (cubic)
  • Form f(n) = n³ − 35n² + 308n + 73
  • Coefficients a = −35, b = 308, c = 73
  • Run length L = 29
  • Domain consecutive n ≥ 0
  • Primality tested on |f(n)|

Official reference

Zenodo record
P. Borghi, "A Prime-Generating Monic Cubic Polynomial with Run Length L = 29", Zenodo, 2025.
Record: DOI

How to cite

Suggested citation (APA-style):

Borghi, P. (2025). A Prime-Generating Monic Cubic Polynomial 
with Run Length L = 29. Zenodo. https://zenodo.org/records/17844166

Author

Paolo Borghi
Independent researcher in number theory and prime-generating polynomials.
paolo.borghi@gmail.com