FLINT3.7.0-dev

gr_factor

Synopsis#include <flint/gr.h>
int gr_factor(gr_ptr c, gr_vec_t factors, fmpz_vec_t exponents, gr_srcptr x, int flags, gr_ctx_t ctx)source

Computes a factorisation x=cf1e1⋯fnenx = c f_1^{e_1} \cdots f_n^{e_n} into distinct irreducible (or prime) factors fkf_k with positive exponents. factors and exponents are resized to length nn.

The unit or content cc is an element of the same ring as the input: the sign −1-1, 00 or 11 in Z\mathbb{Z}, the sign times the content (as a constant polynomial) in Z[x]\mathbb{Z}[x], the leading coefficient in F[x]F[x]. The factors are not sorted in any particular order. flags selects options of the ring's algorithm; 0 gives the default. Implemented for Z\mathbb{Z}, Q\mathbb{Q}, multivariate polynomials and rational functions over Z\mathbb{Z} and Q\mathbb{Q}, and univariate polynomials (gr_ctx_init_gr_poly, gr_ctx_init_fmpz_poly) over Z\mathbb{Z}, Z/pZ\mathbb{Z}/p\mathbb{Z}, finite fields, algebraic numbers (qqbar, ca) and complex balls and floating-point numbers, the last ones by root-finding. Other rings return GR_UNABLE.

Cite this page

The FLINT team, “gr_factor (gr.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr/gr_factor.html (generated 2026-11-02).