WorksComputer Science
Deterministic Polynomial-Time Factorization over Finite Fields
Abstract
Using prime-field factorization and a Dedekind zeta zero-free theorem, we obtain deterministic polynomial-time algorithms for complete factorization over finite fields and for constructing their presentations from their orders.
Introduction
Let be a prime, let , and put . Write for a field of order and for its prime field. Factoring a nonzero polynomial in the indeterminate over means finding its leading coefficient and its distinct monic irreducible factors with their multiplicities. The deterministic complexity problem asks for a single algorithm whose number of bit operations is polynomial in the degree and , as both vary. Even a polynomial known to split into distinct linear factors poses the problem of finding its roots without testing all field elements.
Berlekamp’s 1967 algorithm [1] distinguishes irreducible factors by linear algebra in the quotient by the input polynomial. For a square-free input , the quotient is a product of fields, one for each irreducible factor. The elements fixed by have coordinates in . A fixed element whose coordinates differ separates the factors by greatest common divisors. Enumerating the possible coordinate values costs up to trials. In 1970 [2 Sections 3–7], Berlekamp reduced factorization over extension fields to root finding over the prime field, using trace and norm constructions to reach split polynomials. He identified deterministic root finding over large prime fields as the remaining difficulty.
Cantor and Zassenhaus [3] used random choices to split products of irreducibles of equal degree. This gives complete factorization in expected polynomial time. In the deterministic setting, Shoup [12] obtained a bound with a square-root dependence on the characteristic, up to smaller factors, and Evdokimov [5] obtained quasipolynomial time under the generalized Riemann hypothesis. A separate problem is to construct the field in which the coefficients are represented. Shoup [11 Theorem 3.1] reduced construction of irreducible polynomials to prime-field factorization, and Lenstra [6 Sections 2 and 7–9] developed deterministic constructions and isomorphisms for explicitly represented finite fields.
OpenAI’s prime-field preprint [8] separates the algebraic algorithm from the task of finding auxiliary primes. Its Theorem 1.2 gives a deterministic algorithm with a cost polynomial in the input length and the values of the auxiliary primes. Its Theorem 1.1 obtains a uniform polynomial bound by invoking a Hecke zero-free theorem. Curetón and Thorner [4 Theorem 1.1] give a fixed zero-free half-plane for Dedekind zeta functions of arbitrary number fields.
Shunia [13 Lemma 4.2] uses this theorem and a weighted difference of prime-ideal sums to find auxiliary primes for odd prime degrees in a primality test. A different approach, due to Spaenlehauer [14], reduces root finding to computations on an elliptic curve and its quadratic twist, with an online bound depending on the group orders of the supplied curve data.
Here we use the Dedekind zeta theorem to construct the full auxiliary table for the prime-field algorithm, including its entry of degree two. We give the extension-field reduction by taking the fixed space of directly. This makes the degree and number of prime-field queries explicit. The same prime-field algorithm supplies the queries in the construction of a field presentation.
An explicit presentation is a quotient in an indeterminate with monic irreducible of degree . A field element is encoded by the coefficients of its representative of degree less than , with each coefficient represented in binary by its residue in . A dense polynomial of degree is encoded by its coefficients. A nonzero constant has an empty factor list.
Theorem 1.1. There is a uniform deterministic algorithm for complete factorization of every nonzero dense polynomial over an explicitly presented finite field of order . For degree the bit cost is polynomial in and . Given the binary integer promised to be a prime power, the algorithm can first construct a presentation in time polynomial in . In this case the polynomial is then supplied in the resulting power basis.
Remark 1.2. The external inputs to Theorem 1.1 are the Dedekind zeta zero-free theorem of Cureton and Thorner [4 Theorem 1.1] and the auxiliary-prime factorization theorem, bit bound, and smoothed prime-ideal estimate of OpenAI [8 Theorem 1.2, Proposition 10.1, and Lemma 11.2].
Remark 1.3. The author of the present paper used Rethlas–OSV [10, 7] to review the following manuscripts in sequence. The first review, of OpenAI’s Deterministic Polynomial Factorization over Prime Fields [8], reported no mathematical issues. The review of Cureton and Thorner’s Dedekind zeta paper [4] identified gaps in the written proof. Rethlas–OSV supplied a revised manuscript with supplementary arguments. The revision passed a second Rethlas–OSV review, which reported no mathematical issues in the material reviewed. Unable to reach the authors, the author posted the review reports and the consolidated revision on GitHub. The subsequent reviews of OpenAI’s companion paper on primitive roots [9] and of the present paper reported no mathematical issues in the material reviewed.
Auxiliary primes and the prime-field algorithm
For a prime-field input of degree , put
For and , the algorithm of [8 Theorem 1.2] requires, for every prime , a rational prime satisfying
For the remaining inputs the table is empty. If is the maximum of 2 and the supplied primes, the bit cost, including upward search for the primes, is by [8 Proposition 10.1].
Lemma 2.1. For , , and each prime , there is a prime satisfying (1) with , uniformly in .
Proof. Write , with the group of complex th roots of unity, and put using the positive real root. Since , it is unramified in . The valuation normalized to give a uniformizer value one at any prime of over therefore gives value one. Hence is Eisenstein at that prime. Its roots are obtained by multiplying by the th roots of unity, all of which lie in , so is cyclic of degree .
For a number field , let and let be its absolute discriminant. Write for the natural logarithm. The cyclotomic degree satisfies , since among the integers up to at most are prime to 6. Let be the monic polynomial whose roots are the primitive th roots of unity. Write , where is the monic cofactor in . At every primitive root , differentiation gives
The product of the left sides is . The product of the cofactor values is the field norm of an algebraic integer, hence an integer. The product of the derivatives is the polynomial discriminant up to sign. It follows that this discriminant divides . The field discriminant divides the polynomial discriminant, giving . For , the product of over the roots is up to sign. Thus the relative discriminant of divides the ideal generated by . The discriminant formula in the tower therefore gives
Since , the weighted sum satisfies
using and .
Fix a smooth, nonnegative, nonzero real function compactly supported in . For real , define
where runs over the nonzero prime ideals of the ring of integers and . Here . By [4 Theorem 1.1], each nontrivial zero of the Dedekind zeta function of satisfies . In the smoothed explicit formula of [8 Lemma 11.2], each zero contributes . The sum of the absolute values of the integrals, over the zeros with multiplicity, is , and the remainder apart from the pole term has this same bound. Hence , with constants depending only on . Applying it to both fields and retaining the weight gives
Suppose there is no prime satisfying (1) in . A term in with and residue degree one over a rational prime has . The Frobenius at acts on by raising to the th power. Residue degree one makes this automorphism the identity, so . By the supposition, in . This is the criterion for being an th power in the cyclic group of order . Then has distinct roots in , so the corresponding prime of splits completely in . Here is prime to the power-basis discriminant, so reduction of the polynomial determines the splitting. The primes of above this prime each have norm . Their terms, with weight , sum to the negative of the term from .
The terms left in enter with a negative sign. A remaining term from with times residue degree at least two lies over a rational prime at most . There are at most such rational primes and at most prime ideals above each. Since on the support of a summand, the number of eligible is at most . Thus each ideal contributes at most , where is the maximum of . Terms with and residue degree one over the four exceptional primes contribute at most . Consequently
where depends only on . Set with a fixed . After division by , the explicit-formula error is . Since , dividing by gives a bound of order , uniformly in . Indeed, , and . Both and are at most one. Choose so the divided error and the divided upper bound are each less than . The main term divided by is at least , a contradiction. The prime obtained is less than .
In the branch and we have . Enumerate the primes by trial division. For each , test successive integers for primality and check (1) by modular exponentiation until a prime is found. Lemma 2.1 gives . The search bound need not be supplied to the algorithm. Substitution in the cited bit bound gives , since . In the empty-table branch the same bound follows with .
Reduction by absolute Frobenius
Proposition 3.1. For a nonzero input of degree over an explicitly presented field of order , complete factorization reduces deterministically to at most prime-field factorizations of split square-free polynomials of degree at most . The other bit operations are polynomial in and .
Proof. Record the leading coefficient and divide by it. For a constant, return the empty list. Consider a monic square-free polynomial of positive degree. In , the map is -linear by the binomial theorem and the equality for . Its matrix is obtained by raising the residue classes of , for and , to the th power modulo and and subtracting the original basis vectors. Gaussian elimination computes a basis of the kernel.
If has distinct irreducible factors, the Chinese remainder theorem identifies the quotient with a product of finite fields. In each field the fixed elements are exactly its prime field, since has at most roots and every element of is a root. Thus the fixed space has dimension over . If , return . Otherwise choose a basis vector of the fixed space outside . Compute the successive powers and test linear dependence over . The powers lie in the fixed space, so a dependence occurs by . At the first dependent power, express it as a linear combination of the preceding powers and move the combination to the left. The resulting monic polynomial has least degree among those annihilating . A polynomial annihilates precisely when it vanishes at every coordinate of . Thus the minimal polynomial is the product of over the distinct coordinate values . Its degree is between and . Factor it over , and for each root take the monic gcd of and the degree- representative of minus . An irreducible factor of divides this gcd exactly when the corresponding coordinate of equals a. As is square-free, the gcds multiply to and partition its irreducible factors into at least two nonempty groups. Recurse on the resulting factors of .
For a general monic polynomial of positive degree, let , using the monic gcd and the formal derivative . For an irreducible factor of exponent in , write with . Then . The field has elements, so divides , whose derivative is . Hence . The exponent of in is therefore if and otherwise. In particular is square-free. Factor by the square-free procedure if it is nonconstant. For each factor so obtained, recover its full multiplicity by repeated exact division and remove its full power. All remaining irreducible-factor multiplicities are divisible by , so the remainder is a th power. In characteristic a th power has only monomial exponents divisible by . If the remainder is nonconstant, divide these exponents by and raise each coefficient to , the inverse of th powering on since . Recurse and multiply the returned multiplicities by . This also treats and terminates because each root step strictly lowers the degree.
Each square-free splitting tree has one query per internal vertex. If there are leaves, the number of edges is the number of internal vertices plus . Each internal vertex has at least two children, so there are at most internal vertices. The sets of irreducibles processed at different root steps are disjoint, and their total size is at most . This gives the query count, including the constant case. Each root step lowers the degree by a factor of , and every successful division lowers the current degree by at least one. There are at most successful divisions in total and at most one failed division per factor whose multiplicity is recovered. Matrices have rows and columns. Multiplication and inversion in the coefficient field use polynomial multiplication and the extended Euclidean algorithm modulo . Quotient multiplication, greatest common divisors, and Gaussian elimination have polynomial cost in , and the binary length of . Binary powering uses a number of multiplications linear in the bit length of the exponent, at most for the powers used here. Since , this gives the stated bit bound.
Constructing the field presentation
Proposition 4.1. Given a prime and a positive integer , an irreducible polynomial of degree over can be constructed using calls to prime-field factorization of degree at most and polynomial additional bit cost in and .
Proof. Return for . For , factor the integer by trial division. For each exact prime power dividing (so and ), first construct a field containing the degree- field over .
Odd . Factor over , and use any one of its irreducible factors as the modulus of a field . The residue class of has th power one by the geometric sum identity and is different from one because the sum takes value at one. Its order in is therefore , and . Write for the exponent of in a positive integer . Put , computed by division by . Starting with the element of order , repeatedly take an th root in until reaching an element of order . In the cyclic group , the image of th powering contains the subgroup of order . Thus an element of order , for , has an th root. If a root has order , then , which forces . For the current element , apply Proposition 3.1 to in the already presented field , with an indeterminate. Choose the root of the first linear factor in a fixed order. If the initial element already has order , the chain is empty.
If a root of has order in an algebraic closure of , its th power has order . Thus is an -power and, since , . Its degree over is the least such that divides , by the criterion for membership in the field of order . First raise to the factor of prime to . By the geometric sum formula, the difference from one is times a sum congruent modulo to the number of its summands, which is prime to . Its valuation is therefore . Then each raising to the th power increases the valuation by one. Indeed, the binomial expansion of in powers of starts with . The terms of degrees through have coefficients divisible by . If and is odd, the term also has valuation strictly greater than . For the same strict inequality holds when . Thus , and the least degree is . Thus the binomial is irreducible and its quotient gives an explicit field whose degree over is divisible by .
. If , take and start at , of order two. The same root chain gives of order . Since , the valuation calculation gives irreducibility of over . If , first construct and let be the class of . The polynomial is irreducible since an element squaring to would have order four in , whose order is . For this is the desired field. For , start the chain at , of order four, and take square roots until reaching an element of order . Use over . Here and the valuation identity gives extension degree over , hence degree over .
. Starting at , perform Artin–Schreier steps. In the current field , choose a basis element outside the image of the -linear map . Its kernel is , so the image has codimension one. The derivative of is . If is one root, the distinct roots are for , so its splitting field is . Each automorphism acts on by translation by such a , giving an injective homomorphism into the additive group of . Since is outside the image, the polynomial has no root in . Thus the group has order and the polynomial is irreducible. Replace by at each step.
In each constructed field, compute the kernels of the -linear maps z \mapsto z^{p^r^a}-z and . Both and divide the ambient degree, so the roots of the corresponding equations are exactly the subfields of degrees and over . Choose a basis vector of the larger kernel outside the smaller one. Every proper subfield of the degree- field is contained in the degree- subfield. The first dependence of the powers of this vector, beginning with the zeroth power, gives its minimal polynomial, of degree .
Take the compositum of the resulting fields by successively adjoining the roots of their defining polynomials. If the current field has degree over , adjoining a root of degree over gives degree over the current field. In fact its orbit under th powering has length , since the construction takes each prime divisor of only once. Thus each polynomial remains irreducible in the corresponding quotient construction. In the resulting degree- field take the sum of the chosen generators. If the sum has degree over , then . For each exact prime power dividing , the subfield of degree exists since that degree divides . It contains the sum and every other generator, so subtraction puts the generator of degree in it as well. Thus divides , and coprimality of and implies . This holds for each prime power, giving . The first linear dependence among the powers of the sum yields its monic minimal polynomial.
All choices can be made by fixed coordinate order or by a fixed elimination procedure. In the root chains the base fields have dimension at most over , so each chain has steps. A step calls Proposition 3.1 on degree , costing at most prime-field queries. The initial cyclotomic queries have degree . The sum of distinct prime divisors of is at most , by iterating for integers . The sum of their squares is at most the square of their sum. The root chains and cyclotomic queries therefore use queries in total. The temporary fields have dimension at most over . Build a multiplication table at each stage of a tower by multiplying its basis monomials and reducing by the monic defining polynomial over the preceding field. The previous table implements arithmetic over that field. The dimensions and defining degrees are bounded by , so each new table uses polynomially many operations. Once a table is available, multiplication is bilinear in the coordinates and inversion is a linear system. The exponent has at most bits. Thus all powering, kernel computations, and changes of basis have polynomial bit cost in and .
Proof of Theorem 1.1. Use the prime-field algorithm of § 2 for the queries of Proposition 3.1. Each query has degree at most , and , giving the asserted polynomial bound. For the presentation interface, recover from the promised prime power by testing exact integer roots in decreasing order of exponent from to . The largest successful exponent is by unique factorization. For each exponent, binary search on the integers from to tests for an exact root. Binary powering with intermediate values capped at keeps the integer bit lengths polynomial in . Apply Proposition 4.1 with the same prime-field algorithm. Since , the query count, query degrees and remaining computation are all polynomially bounded in .
Zhili College, Tsinghua University, Beijing 100084, China
Email address: [email protected]
References
- [1]E. R. Berlekamp, Factoring polynomials over finite fields, Bell System Tech. J. 46 (1967), 1853–1859.DOI
- [2]E. R. Berlekamp, Factoring polynomials over large finite fields, Math. Comp. 24 (1970), 713–735.
- [3]D. G. Cantor and H. Zassenhaus, A new algorithm for factoring polynomials over finite fields, Math. Comp. 36 (1981), 587–592.DOI
- [4]D. Cureton and J. Thorner, A quasi-Riemann hypothesis for Dedekind zeta functions, Hexagon 2610.00200v2, 2026.
- [5]S. Evdokimov, Factorization of polynomials over finite fields in subexponential time under GRH, Algorithmic Number Theory, Lecture Notes in Comput. Sci. 877, Springer, 1994, 209–219.DOI
- [6]H. W. Lenstra, Jr., Finding isomorphisms between finite fields, Math. Comp. 56 (1991), 329–347.DOI
- [7]F. Nie, H. Ye, S. Liu, Z. Wang, S. Ermon, and J. Zou, One-sided verification under limited expert review, arXiv:2610.18089v2, 2026.arxiv.org/abs/2610.18089
- [8]OpenAI, Deterministic polynomial factorization over prime fields, preprint, October 4, 2026.
- [9]OpenAI, Primitive roots for every admissible integer base, preprint, October 4, 2026.
- [10]OSVerify contributors, Rethlas–OSV, software, 2026.
- [11]V. Shoup, New algorithms for finding irreducible polynomials over finite fields, Math. Comp. 54 (1990), 435–447.
- [12]V. Shoup, On the deterministic complexity of factoring polynomials over finite fields, Inform. Process. Lett. 33 (1990), 261–267.DOI
- [13]J. M. Shunia, Deterministic polynomial-time primality testing with a single binomial congruence, arXiv:2611.02280v1, 2026.arxiv.org/abs/2611.02280
- [14]P.-J. Spaenlehauer, Deterministic root-finding over finite fields with elliptic curves, 2026. arXiv:2610.32508v1.arxiv.org/abs/2610.32508