// primef.c factor numbers up to 63 bits #include #include #include "primef.h" int main(void) { int i, j, nfact = 0;; long int rem, quo, prod, chk; long int fctr[10000]; double now, next; printf("primef.c running, enter a number to factor \n"); while(1) { scanf("%ld", &rem); now = (double)clock()/(double)CLOCKS_PER_SEC; printf("factor %ld \n", rem); if(rem<2l) { printf("primef.c finished \n"); return 0; } j = 0; nfact = 0; while(j=np) { fctr[nfact] = rem; nfact++; } if(rem != 1) printf("a factor is %ld \n", rem); if(rem>primes[np-1]*primes[np-1]) { printf("need more primes rem=%ld \n", rem); } next = (double)clock()/(double)CLOCKS_PER_SEC; printf("factored in %f seconds\n", next-now); chk = 1l; // check result for(i=0; i