prime factorisation method to find hcf