Better way to find all the prime factors of huge integers in C?
问题 I have written a code in C that basically makes a list of all the prime factors of a huge number, which is stored using the gmp library. Here it is : int is_div(mpz_t number, mpz_t i) { return mpz_divisible_p(number,i)!=0; } mpz_t * prime_divs(mpz_t number){ mpz_t * prime_dividers = NULL; mpz_t i, i_squared,TWO, comp; mpz_inits(i, i_squared, TWO, comp, NULL); mpz_set_ui(i,2); mpz_mul(i_squared, i ,TWO); while(mpz_cmp(i_squared,number)<=0){ if(is_div(number,i)){ mpz_fdiv_q(comp, number, i); if