Greatest Common Factor Using Prime Factorization