'Return Factors of ``gcd(self, other)``. The keys are
the intersection of factors with the minimum exponent for
each factor.
Examples
>>> from sympy.core.exprtools import Factors
>>> from sympy.abc import x, y, z
>>> a = Factors((x*y**2).as_powers_dict())
>>> b = Factors((x*y/z).as_powers_dict())
>>> a.gcd(b)
Factors({x: 1, y: 1})'

def gcd(self, other):

    if (not isinstance(other, Factors)):
        other = Factors(other)
        if other.is_zero:
            return Factors(self.factors)
    factors = {}
    for (factor, exp) in self.factors.items():
        (factor, exp) = (sympify(factor), sympify(exp))
        if (factor in other.factors):
            lt = (exp - other.factors[factor]).is_negative
            if (lt == True):
                factors[factor] = exp
            elif (lt == False):
                factors[factor] = other.factors[factor]
    return Factors(factors)
