mpz_trial_div

Paul Leyland pleyland@microsoft.com
Thu, 14 Nov 2002 08:44:55 -0800


> From: Jason Moxham [mailto:J.L.Moxham@maths.soton.ac.uk]=20
...
> > > 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.
> >
> > I thought we'd agreed, wrongly it appears, that mpz_trial_div would
> > return only prime factors and would always return the smallest=20
> > such (perhaps in the range start--end if those arguments are =
present).
>=20
> if mpz_trial_div can return 3*5 say , then it gets very=20
> complicated (and SLOW), see my previous email on it , I
> recomend only returning prime factors in order .

Strongly agree.   If it really does turn out to be much faster to return =
composite factors, then please provide an interface that does return =
them prime and in order.  Whether that's another function or a flag =
argument to a single function doesn't much matter --- testing a flag =
surely doesn't take long compared with a gcd.


Paul