(self, limit=None, use_trial=True, use_rho=False,
                use_pm1=False, verbose=False, visual=False)
A wrapper to factorint which return factors of self that are
        smaller than limit (or cheap to compute). Special methods of
        factoring are disabled by default so that only trial division is used.
A wrapper to factorint which return factors of self that are
        smaller than limit (or cheap to compute). Special methods of
        factoring are disabled by default so that only trial division is used.
A wrapper to factorint which return factors of self that are smaller than limit ( or cheap to compute ) . Special methods of factoring are disabled by default so that only trial division is used .
def factors(self, limit=None, use_trial=True, use_rho=False,
                use_pm1=False, verbose=False, visual=False):
        """A wrapper to factorint which return factors of self that are
        smaller than limit (or cheap to compute). Special methods of
        factoring are disabled by default so that only trial division is used.
        """
        from sympy.ntheory import factorint

        f = factorint(self.p, limit=limit, use_trial=use_trial,
                      use_rho=use_rho, use_pm1=use_pm1,
                      verbose=verbose).copy()
        f = defaultdict(int, f)
        for p, e in factorint(self.q, limit=limit,
                              use_trial=use_trial,
                              use_rho=use_rho,
                              use_pm1=use_pm1,
                              verbose=verbose).items():
            f[p] += -e

        if len(f) > 1 and 1 in f:
            del f[1]
        if not f:
            f = {1: 1}
        if not visual:
            return dict(f)
        else:
            if -1 in f:
                f.pop(-1)
                args = [S.NegativeOne]
            else:
                args = []
            args.extend([Pow(*i, evaluate=False)
                         for i in sorted(f.items())])
            return Mul(*args, evaluate=False)
def factors ( self , limit = None , use_trial = True , use_rho = False , use_pm1 = False , verbose = False , visual = False ) : from sympy . ntheory import factorint f = factorint ( self . p , limit = limit , use_trial = use_trial , use_rho = use_rho , use_pm1 = use_pm1 , verbose = verbose ) . copy ( ) f = defaultdict ( int , f ) for p , e in factorint ( self . q , limit = limit , use_trial = use_trial , use_rho = use_rho , use_pm1 = use_pm1 , verbose = verbose ) . items ( ) : f [ p ] += - e if len ( f ) > 1 and 1 in f : del f [ 1 ] if not f : f = { 1 : 1 } if not visual : return dict ( f ) else : if - 1 in f : f . pop ( - 1 ) args = [ S . NegativeOne ] else : args = [ ] args . extend ( [ Pow ( * i , evaluate = False ) for i in sorted ( f . items ( ) ) ] ) return Mul ( * args , evaluate = False )