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 stacksize
under csh.
To compile toy.c, type
gcc -o toy toy.c -lgmp
To run it, type
./toy < in > out
The 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
00
The output is a series of smaller factorization problems:
2
0
23456
00
2
0
34567
00
If you feed the output through toy again,
you'll get
2
0
23456
00
0
34567
00
For large problems you may have to run toy several times
before the output stabilizes.