Dixon’s algorithm chooses r at random, but we instead choose r systematically, starting with √n and increasing by 1 at each step. Residue takes a k parameter, for compatibility with the rest of the program, but doesn’t use it. Everything else is the same as CFRAC.
Dixon’s algorithm is quite slow. The example computes the factorization of the 73rd Fibonacci number, 806515533049393 = 9375829 × 86020717 in about an hour; for comparison, Pollard’s rho algorithm computes the factorization in a few milliseconds. But the value of Dixon’s algorithm is not that it is practical for factoring integers but that the randomization allows it to be analyzed and its “big-oh” run-time determined, which can’t be done for any of the other advanced factorization algorithms such as elliptic curves or quadratic sieve.
The code is assembled at http://programmingpraxis.codepad.org/NVi2RHLa.