calculated the sum of common factors