Prime-generating polynomial · Official record

Polynomial (L = 30)

A Prime-Generating Monic Cubic Polynomial

Documented by Paolo Borghi — Verified computationally (2025)

The polynomial

f(n) = n³ + 23n² − 1988n + 24223

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

Category: monic cubic prime-generating polynomial

The polynomial

f(n) = n³ + 23n² − 1988n + 24223

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 = 30

making it one of the longest documented prime-generating runs for a monic cubic polynomial.

Formal statement of the record

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.

Prime values for 0 ≤ n ≤ 29

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
024223
122259
220347
318493
416703
514983
613339
711777
810303
98923
107643
116469
125407
134463
143643
152953
162399
171987
181723
191613
201663
211879
222267
232833
243583
254523
265659
276997
288543
2910303

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 for verifying a single polynomial 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:

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

Record summary

  • Name Borghi Polynomial
  • Degree 3 (cubic)
  • Form f(n) = n³ + 23n² − 1988n + 24223
  • Coefficients a = 23, b = −1988, c = 24223
  • Run length L = 30
  • 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 = 30", Zenodo, 2025.
Record: DOI

How to cite

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

Author

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