On Wed, Feb 23, 2011 at 12:03 PM, kcrisman <[email protected]> wrote:
> In all recent alphas and rc0:

And also in the *released* sage-4.6.1...

This is definitely a serious bug.    It should be reported to the sage
trac and upstream to the PARI developers.

? znprimroot(15)
%1 = Mod(2, 15)
? znprimroot(8)
  ***   at top-level: znprimroot(8)
  ***                 ^-------------
  *** znprimroot: primitive root mod 8 does not exist.


>
> sage: primitive_root(15)
> 2
> sage: mod(2,15).multiplicative_order()
> 4
> sage: euler_phi(15)
> 8
> sage: [mod(2,15)^i for i in [1..8]]
> [2, 4, 8, 1, 2, 4, 8, 1]
>
> sage: b = pari(15)
> sage: b.znprimroot()
> Mod(2, 15)
>
> Definition:     b.znprimroot(self)
> Docstring:
>
>       Return a primitive root modulo self, whenever it exists.
>
>       This is a generator of the group (ZZ/nZZ)^*, whenever this
> group
>       is cyclic, i.e. if n=4 or n=p^k or n=2p^k, where p is an odd
> prime
>       and k is a natural number.
>
>       INPUT:
>
>       * ``self`` - positive integer equal to 4, or a power of an odd
>         prime, or twice a power of an odd prime
>
> BUT
>
> ----------------------------------------------------------------------
> | Sage Version 4.4.4, Release Date: 2010-06-23                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> Loading Sage library. Current Mercurial branch is: hackbranch
> sage: primitive_root(15)
> <snip>
> ArithmeticError: There is no primitive root modulo n
>
>
> Please tell me that I am just missing some obvious reason this is
> correct behavior.  Or has Pari changed its definition?  But
> http://pari.math.u-bordeaux.fr/dochtml/html.stable/Arithmetic_functions.html#znprimroot
> says
>
> znprimroot(n)
>
> returns a primitive root (generator) of (Z/nZ)^*, whenever this latter
> group is cyclic (n = 4 or n = 2p^k or n = p^k, where p is an odd prime
> and k >= 0).
>
> The library syntax is gener(x).
>
> - kcrisman
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to 
> [email protected]
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to