Fermat's factorization algorithm