common factor mathematica