#include #include #include int main (int argc, char **argv) { long long int fac, fact, i, j, z; if (argc <1){ printf( "There is no number to factorize\n" ); if (scanf( "Enter number: %Ld", &fac)){}; }else{ fac = atoll(argv[1]); } if (fac<=0) return -1; fact = fac; /* The 100 million primes */ z = 2038074743; printf( "The limit to factorize is %Ld\n",z); if (fact> z) printf ("Out of order (>%Ld)\n",z); printf("%Ld->\n",fact); FILE * MB; MB = fopen("primes.100M", "r"); while (fscanf(MB,"%Ld\n", &i) !=EOF){ if (fact % i ==0){ j=1; while ( fact % (long long int)(pow(i,j+1)) ==0 ){ j++; } printf ("%Ld , %Ld\n", i , j); fact /= pow(i,j); if (fact==1) break; } if (i > fact) break; } fclose(MB); if (fact>1) printf ("resto = %Ld\n", fact); if (fact>z) { printf("El resto es mayor que el lĂ­mite actual. Posible primo.\n"); } printf ("\n"); return 0; }