Why stop Pollard's rho after $\sqrt{N}$ iterations and not $\sqrt[4]{N}$?

222 Views Asked by At

Let $N = pq$ where $p < q$, both prime. It is believed that Pollard's rho expects $\sqrt{p}$ steps on average. It's a fact that $p \leq \sqrt{N}$, so $\sqrt{p} \leq \sqrt[4]{N}$. This means it is believed that the algorithm should stop around $\sqrt[4]{N}$ steps. But look at this Racket implementation. They're running the loop up to $\sqrt{N}$.

;;; ALGORITHM 19.8  Pollard's rho method
; INPUT   n>=3 neither a prime nor a perfect power
; OUTPUT  Either a proper divisor of n or #f
(: pollard : Natural -> (U Natural False))
(define (pollard n)
  (let ([x0 (random-natural n)])
    (do ([xi x0 (remainder (+ (* xi xi) 1) n)]
         [yi x0 (remainder (+ (sqr (+ (* yi yi) 1)) 1) n)]
         [i  0  (add1 i)]
         [g  1  (gcd (- xi yi) n)])
      [(or (< 1 g n) (> i (sqrt n)))
       (if (< 1 g n)
           (cast g natural?)
           #f)])))

Question. Shouldn't they run it up to $\sqrt[4]{N}$ and not $\sqrt{N}$? What am I missing?