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 = c f_1^{e_1} \cdots f_n^{e_n} into distinct irreducible (or prime) factors f_k with positive exponents. factors and exponents are resized to length n.

The unit or content c is an element of the same ring as the input: the sign -1, 0 or 1 in \mathbb{Z}, the sign times the content (as a constant polynomial) in \mathbb{Z}[x], the leading coefficient in 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 \mathbb{Z}, \mathbb{Q}, multivariate polynomials and rational functions over \mathbb{Z} and \mathbb{Q}, and univariate polynomials (gr_ctx_init_gr_poly, gr_ctx_init_fmpz_poly) over \mathbb{Z}, \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-10-20).