FLINT3.7.0-dev

gr_poly_is_irreducible, gr_poly_is_irreducible_ben_or, gr_poly_is_irreducible_ddf, gr_poly_is_irreducible_rabin

Synopsis#include <flint/gr_poly.h>
truth_t gr_poly_is_irreducible(const gr_poly_t f, gr_ctx_t ctx)source
truth_t gr_poly_is_irreducible_ben_or(const gr_poly_t f, gr_ctx_t ctx)source
truth_t gr_poly_is_irreducible_ddf(const gr_poly_t f, gr_ctx_t ctx)source
truth_t gr_poly_is_irreducible_rabin(const gr_poly_t f, gr_ctx_t ctx)source

Return whether f is irreducible over \mathbb{F}_q. Constants are not irreducible.

The ben_or version uses Ben-Or's test [BenOr1981], computing \gcd(f, x^{q^i} - x) for i \le n/2 with the Frobenius iterates obtained by modular composition or exponentiation. The ddf version runs the coarse phase of the baby-step giant-step distinct-degree factorisation (gr_poly_factor_distinct_deg) and stops at the first factor found, which is fast on inputs with small factors. The rabin version uses Rabin's test [Rab1980b]: f of degree n is irreducible if and only if x^{q^n} \equiv x \bmod f and \gcd(x^{q^{n/r}} - x, f) = 1 for every prime r \mid n; the Frobenius powers are computed by modular composition from the ladder x^{q^{2^i}}, so that the test costs O((1 + \omega(n)) \log n) compositions after the initial x^q, against about 2 \sqrt{n} for the distinct-degree test, but it does not stop early on inputs with small factors.

The default version first looks for roots by evaluation when the field is a small prime field; for degree below 600 it then calls the ddf version, and from 600 on it checks squarefreeness, removes inputs with factors of degree at most 4 with a few gcds, and calls the rabin version.

References#

  • [BenOr1981] M. Ben-Or. Probabilistic algorithms in finite fields. 22nd Annual Symposium on Foundations of Computer Science (FOCS 1981), IEEE, 394–398.
  • [Rab1980b] M. O. Rabin. Probabilistic algorithms in finite fields. SIAM Journal on Computing 9 (1980), 273–280.
Cite this page

The FLINT team, “gr_poly_is_irreducible, gr_poly_is_irreducible_ben_or, gr_poly_is_irreducible_ddf, gr_poly_is_irreducible_rabin (gr_poly.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_poly/gr_poly_is_irreducible.html (generated 2026-10-20).