title: Scheme code for Pollard's Rho algorithm
body: <p>I am trying to learn scheme by implementing few algorithms.</p>
  
  <pre><code>Pollards-Rho(n)
   g(x) = x2 + 1 mod n
      x ← 2; y ← 2; d ← 1;
      While d = 1:
          x ← g(x)
          y ← g(g(y))
          d ← gcd(|x - y|, n)
      If d = n, return failure.
      Else, return d
  </code></pre>
  
  <p>I am trying to implement the above algorithm in scheme. Any help would be appreciated. Thanks</p>