Bill Allombert on Wed, 1 May 2002 13:51:49 +0200

 Re: GP: ffinit() bug

```On Tue, Apr 30, 2002 at 11:23:33AM -0400, Michael Somos wrote:
> Thank you for the additional information, but this is a bit difficult
> to accept. I tried other values. For example :
>
> ? ffinit(6,2)
> %2 = Mod(1, 6)*x^2 + Mod(1, 6)*x + Mod(2, 6)

By luck, this polynomial is irreducible over Z/6Z.

> and even though there is no field 'F_6' it returned a result. The result
> may be nonsense, but that may be up to the user to decide. What is hard
> to accept is the infinite loop. However, if that is the desireable way
> to go, a clear warning about this seems to be in order. There is no way
> to always protect the user from himself, but we can try. Shalom, Michael

We try to avoid segmentation violation error in these cases, but infinite loop
are more difficult to track. We managed to fix that in sqrt(Mod(a,p)) but doing
it for ffinit is more involved¹.  On the other hand, fixing nonsense output from
nonsense input is out of the question, since it is equivalent to develop a
faster primality test program.

Also, if you use p in a loop and every Fp related functions you use check the
primality of p, you will loose a lot of time...

¹ a mathematical problem:

For which integer value of a and b, there exists a prime number p
so that p=1 [mod b] and a is not a l--power mod p for all prime l dividing b ?

There is no solution for (a,b)=(2,8),(3,12) or (5,10), for example, by