Integer factorization using FLINT#


  • Michael Orlitzky (2023)


Factor the nonzero integer n using FLINT.

This function returns a list of (factor, exponent) pairs. The factors will be of type Integer, and the exponents will be of type int.


  • n – a nonzero sage Integer; the number to factor.


A list of (Integer, int) pairs representing the factors and their exponents.


   sage: from sage.rings.factorint_flint import factor_using_flint
   sage: n = ZZ(9962572652930382)
   sage: factors = factor_using_flint(n)
   sage: factors
   [(2, 1), (3, 1), (1660428775488397, 1)]
   sage: prod( f^e for (f,e) in factors ) == n

Negative numbers will have a leading factor of ``(-1)^1``::

   sage: n = ZZ(-1 * 2 * 3)
   sage: factor_using_flint(n)
   [(-1, 1), (2, 1), (3, 1)]

The factorization of unity is empty:

sage: factor_using_flint(

While zero has a single factor, of… zero:

sage: factor_using_flint(
[(0, 1)]