mpz_trial_div

Torbjorn Granlund tege@swox.com
14 Nov 2002 16:32:29 +0100


"Paul Leyland" <pleyland@microsoft.com> writes:

  > Possible , although I think it is unneccessairy (as we have 
  > the mpz fn mpz_remove_ui) , consider
  > 
  > d=mpz_trial_div(N,1,10000);
  > m=mpz_remove_ui(N,N,d);
  > 
  > to cover the multiplicity case
  
  Fair point.  Thanks.

Not sure that would work.  Assume our number has the factor 3^2*5.
mpz_trial_div might find 3*5 and return that.  mpz_remove_ui
would then typically leave one factor 3.

Since some usages of mpz_trial_div will only care if any factor is
found, we don't want to slow it down by having it figure out any
factor multiplicity.

-- 
Torbjörn