Consider c = rs, where r is the product of the prime factors of c that occur in a, and s is the product of the prime factors of c that occur in b.