John Cremona on Fri, 07 Sep 2007 21:57:14 +0200

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

bug in isprime()

Running this version:

                                                 GP/PARI CALCULATOR
Version 2.4.2 (development CHANGES-1.1844)
                                                         i686 running
linux (ix86 kernel) 32-bit version
                                                    compiled: Aug 18
2007, gcc-4.1.2 (Ubuntu 4.1.2-0ubuntu4)
v5.2 enabled, extended help enabled)

the manual claims that while the out of factor() contains "primes"
which are not proved primes, the function isprime() provides a proof
of primality.  In which case what is going on here:

 ? default(debug,2)
%5 = 2
? p=nextprime(10^20)
%6 = 100000000000000000039
? isprime(p)
  *** isprime: Warning: IFAC: untested integer declared prime.
%7 = 1

It seems that part of the "proof" involves a factorization whose
results are not proved.

Unless I am misunderstanding what the manual claims, this means that
it is _not_ doing what is claimed.

One solution would be (as I suggested earlier) to have a flag on
factor() to require proof, as this could be passed on down through
isprime() calls, and then we could trust the results!


John Cremona