/************************************************* * dixon.cc -- Factor any integer into primes using Dixon's random * squares method. * * Compile: * g++ -s -O4 -o fact fact.cc * Invoke: * ./fact NumberToFactor * * ChangeLog * 970324 -- Created by Paul Herman * Future -- I want to later include the Linear Algebra routines - Paul ********************************************************/ #include #define max_k 20 /*************************** * factor(Integer n) * Given n, try to find a factor. ****************************/ Integer factor(Integer n) { Integer x, xx, y, d, q, rt; int i, j; rt = sqrt(n); if (issquare(n)) return rt; x = rt; for (;;x++) { d = gcd(x, n); if (1