// primef2.c factor numbers up to 63 bits, need 64 bit computer, OS, compiler // factor up to 0.922*10^20 about 19 digits // the first one million primes are in the executable program #include #include #include "primef2.h" // primes and np come from here int main(void) { int i, j, nfact = 0;; long int rem, quo, prod, chk; long int fctr[100]; // actually could be 63, 2^63 has most double now, next; int rtn; printf("primef2.c running, enter a number, less than 64 bits, to factor\n"); while(1) { rtn = scanf("%ld", &rem); if(rtn==0 || rtn==EOF) return 0; now = (double)clock()/(double)CLOCKS_PER_SEC; printf("factor %ld \n", rem); if(rem<2l) { printf("primef2.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); chk = 1l; // check result for(i=0; i