Igor Schein on Thu, 14 Mar 2002 17:53:07 -0500

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

Re: isprime functions

On Thu, Mar 14, 2002 at 09:57:12PM +0000, Mark Chimley wrote:
> I have been trying to do some simple verifications of "primeness" using
> the functions long isprime (GEN x) and GEN gisprime (GEN X, long flag)
> under PARI 2.1.0. I am having a lot of problems. I started with the
> simpler function, isprime, but this regularly reported "division by zero
> in dvmdii" for randomly selected integers. With these problems I tried
> gisprime (X, 1), which uses the Lucas-Lehmer test instead of M-R.
> However, this appeared to cause random problems with gadd (I was adding
> two in a loop until a number passed gisprime). The errors with gadd
> ranged from segmentation faults to "forbidden *** unknown type n", where
> n ranged from 30 to 200 or so.
> Due to the random nature of these errors, it would seem less likely that
> the problem is with the code surrounding the loop (i.e. user error with
> the PARI stack!), although obviously this cannot be ruled out. It would
> also seem unlikely that there is a problem with such fundamental
> functions.
> Any help in determining the cause of these problems would be gratefully
> appreciated.

What version of gp are you using?  Can you provide an example of a prime
which results in an error?  Can you reproduce the error using gp?