Karim Belabas on Sat, 16 Jul 2011 12:44:42 +0200


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

Re: znlog() behavior


* Max Alekseyev [2011-07-16 11:51]:
> It seems that the actual reason is that 2^67-1 is a product of two
> primes as has no primitive root.
> Would it be more natural and intuitive if znprimroot() complained about that?

You can have that :

  ? Fp_primroot(p)= if(!isprime(p), error(p, " is not prime")); znprimroot(p);
  ? Fp_primroot(2^67-1)
  ***   at top-level: Fp_primroot(2^67-1)
  ***                 ^-------------------
  ***   in function Fp_primroot: if(!isprime(p),error(p," is not pri
  ***                                           ^--------------------
  ***   user error: 147573952589676412927 is not prime

But there's a price to pay :
  ? p = nextprime(2^67)
  ? for(i=1,10^4, znprimroot(p))
  time = 1,845 ms.
  ? for(i=1,10^4, Fp_primroot(p))
  time = 7,372 ms.

Your choice :-)

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`