Replace Rational's gcd with IntFactorization's one