smallfactors is a serious implementation, using Zmult for fast multiplication and streamlined Newton for fast 2-adic division. Watch this space for the first release.
Beware that GMP allocates large temporary variables on the stack. If the stack runs out of space, the kernel kills the program with a segmentation fault. Make sure to remove the stack-size resource limit before using GMP: e.g.,
unlimit stacksizeunder csh.
To compile toy.c, type
gcc -o toy toy.c -lgmpTo run it, type
./toy < in > outThe input file is series of factorization problems. Each problem is a list of primes, a 0, a list of integers to be factored, and a 00:
2 3 5 0 23456 34567 00The output is a series of smaller factorization problems:
2 0 23456 00 2 0 34567 00If you feed the output through toy again, you'll get
2 0 23456 00 0 34567 00For large problems you may have to run toy several times before the output stabilizes.