Brent cycle-finding algorithm Created 2026-10-20 Updated 2026-11-05
For a deterministic iteration with eventual cycle length and preperiod , the Brent cycle-finding algorithm detects repetition using constant auxiliary space.
Hold a checkpoint fixed while another pointer advances through blocks of lengths . At a block boundary, move the checkpoint to the advancing pointer and double the next block length. Compare each new state to the checkpoint. Once the checkpoint lies on the cycle and its block is long enough, the first equality occurs exactly steps after the checkpoint.
To locate the entrance, restart two pointers at the initial state, advance one by steps, then move both one step at a time until they agree. Before index , the first pointer is outside the cycle; at both reach the same cyclic position. The procedure uses evaluations of and constant auxiliary space, assuming constant-cost state equality and copying. An infinite nonperiodic orbit has no finite detection guarantee.[ref]
Brent variant of Pollard rho Created 2026-10-20 Updated 2026-11-05
The Brent variant of Pollard rho finds factors of a composite integer by iterating a map such as . A collision modulo an unknown prime factor can be detected through . Brent's variant organizes comparisons in blocks whose lengths double, reducing the work of cycle detection compared with comparing two iterates at every step.[ref]
An improved Monte Carlo factorization algorithm by Richard P. Brent. §§3–4, cycle finding and factorization
It can also batch differences: compute their product modulo and take one greatest common divisor per block. If that gcd is , retry the saved differences individually to recover a proper factor, or restart with a different orbit. The commonly used square-root-of-factor runtime estimate is heuristic and depends on treating the orbit modulo that factor like a random map.
Richard P. Brent 2026-11-05
Richard P. Brent works on computational mathematics, including arithmetic algorithms, integer factorization and numerical methods. His ANU publication and software pages document these interests.[ref]
His 1980 factorization paper improves cycle detection in iterated sequences and applies it to a Monte Carlo factorization method. A collision modulo an unknown prime divisor can be exposed through a greatest common divisor, even when the iterates do not coincide modulo the whole integer. Batching computations and improving cycle finding reduce the work required.[ref]
An improved Monte Carlo factorization algorithm by Richard P. Brent. Sections 2–7, cycle finding and factorization