Integer factorization using PARI#

AUTHORS:

  • Jeroen Demeyer (2015)

sage.rings.factorint_pari.factor_using_pari(n, int_=False, debug_level=0, proof=None)#

Factor this integer using PARI.

This function returns a list of pairs, not a Factorization object. The first element of each pair is the factor, of type Integer if int_ is False or int otherwise, the second element is the positive exponent, of type int.

INPUT:

  • int_ – (default: False), whether the factors are of type int instead of Integer

  • debug_level – (default: 0), debug level of the call to PARI

  • proof – (default: None), whether the factors are required to be proven prime; if None, the global default is used

OUTPUT:

A list of pairs.

EXAMPLES:

sage: factor(-2**72 + 3, algorithm='pari')  # indirect doctest
-1 * 83 * 131 * 294971519 * 1472414939

Check that PARI’s debug level is properly reset (github issue #18792):

sage: alarm(0.5); factor(2^1000 - 1, verbose=5)
Traceback (most recent call last):
...
AlarmInterrupt
sage: pari.get_debug_level()
0