prime factorization method to find square root