math/mpreduce.h: Missing include files.
[u/mdw/catacomb] / utils / fact.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #include <mLib/quis.h>
6
7 #include "factor.h"
8
9 int main(int argc, char *argv[])
10 {
11 mp *n;
12 fact_v fv = DA_INIT;
13 unsigned i;
14
15 ego(argv[0]);
16 if (argc != 2) {
17 fprintf(stderr, "Usage: %s N\n", QUIS);
18 exit(1);
19 }
20 n = mp_readstring(MP_NEW, argv[1], 0, 10);
21 factor(n, &fv);
22 for (i = 0; i < DA_LEN(&fv); i++) {
23 mp_writefile(DA(&fv)[i].p, stdout, 10);
24 printf("^%u\n", DA(&fv)[i].e);
25 }
26 freefactors(&fv);
27 return (0);
28 }