Find greatest common factor