Pollard's rho algorithm