Bill Allombert on Tue, 18 Sep 2007 01:45:04 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: adding Proof option to factor()


On Wed, Sep 12, 2007 at 12:35:03PM +0200, Karim Belabas wrote:
> * John Cremona [2007-09-07 11:18]:
> > The factor() function for integers (i.e. factorint()) does not provide
> > factors which are proved to be prime, unless they are are < 10^15,
> > accoriding to the manual.  The manual recommends using isprime() in
> > circumstances where proven primes are required.
> > 
> > Could we add another flag to the function which defaults to 0 but if
> > set does the proving step too?  I use pari's factor() in mwrank and am
> > not happy that I cannot guarantee results because of this, and it
> > would be a lot easier to just add af lag to the call I make to
> > factor().
> 
> I don't like complicating the user interface for something which is easy to
> implement externally, usually in a more flexible way. There's already an
> optional argument to factor, and having two flags is very error-prone
> [ consider factor(n,1), factor(n,,1), factor(n,100000,1),
> factor(n,1,10000), etc. ]

Please note that we have factorint which already accept a flag.

But actually what we need is a default(), not a flag: factorisation is a
pervasive operation in PARI/GP, and if you want a proven result, you
have to prove each and every factorizations that occurs during the
computation.  That would be something like:
? default(factor_proven,1)

This is the reason factor_add_primes is a default and not a flag.

Cheers,
Bill.