Updated Pollard's p-1 algorithm