Pollard's Rho Factorization
Race two iterates through a modular pseudo-random sequence until a gcd reveals a nontrivial factor.
Core idea
Iterate a pseudo-random polynomial modulo n with tortoise and hare speeds. When the two values collide modulo an unknown factor, the gcd of their difference with n reveals that factor.
Read the visualization
The graph tracks both sequence positions and the gcd at each race step. A later factor-colored view shows why the sequence forms a tail and cycle modulo the hidden divisor.
Begin with a composite integer whose useful factor is too large for short trial division.
Complexity and tradeoffs
Time: Expected O(n^1/4). Space: O(1). Random restarts handle unlucky cycles; primality testing separates terminal factors.
Where it fits
Pollard's Rho is effective for composites with moderately small factors and pairs naturally with Miller-Rabin, recursive splitting, and random restarts.