Integer factorization using PARI¶
AUTHORS:
- Jeroen Demeyer (2015) 
- sage.rings.factorint_pari.factor_using_pari(n, int_=False, debug_level=0, proof=None)[source]¶
- Factor this integer using PARI. - This function returns a list of pairs, not a - Factorizationobject. The first element of each pair is the factor, of type- Integerif- int_is- Falseor- intotherwise, the second element is the positive exponent, of type- int.- INPUT: - int_– (default:- False), whether the factors are of type- intinstead 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: list of pairs - EXAMPLES: - sage: factor(-2**72 + 3, algorithm='pari') # indirect doctest -1 * 83 * 131 * 294971519 * 1472414939 - >>> from sage.all import * >>> factor(-Integer(2)**Integer(72) + Integer(3), algorithm='pari') # indirect doctest -1 * 83 * 131 * 294971519 * 1472414939 - Check that PARI’s debug level is properly reset (Issue #18792): - sage: from sage.doctest.util import ensure_interruptible_after sage: with ensure_interruptible_after(0.5): factor(2^1000 - 1, verbose=5) ... doctest:warning... RuntimeWarning: cypari2 leaked ... bytes on the PARI stack sage: pari.get_debug_level() 0 - >>> from sage.all import * >>> from sage.doctest.util import ensure_interruptible_after >>> with ensure_interruptible_after(RealNumber('0.5')): factor(Integer(2)**Integer(1000) - Integer(1), verbose=Integer(5)) ... doctest:warning... RuntimeWarning: cypari2 leaked ... bytes on the PARI stack >>> pari.get_debug_level() 0