#10836: primitive root is broken
-----------------------------------+----------------------------------------
   Reporter:  kcrisman             |       Owner:  was                          
                 
       Type:  defect               |      Status:  needs_review                 
                 
   Priority:  critical             |   Milestone:  sage-4.7                     
                 
  Component:  number theory        |    Keywords:                               
                 
     Author:  Karl-Dieter Crisman  |    Upstream:  Reported upstream. 
Developers deny it's a bug.
   Reviewer:                       |      Merged:                               
                 
Work_issues:                       |  
-----------------------------------+----------------------------------------

Comment(by dsm):

 I think maybe there's a little too much duplication with all the branches?
 ISTM it's simpler to implement the condition exactly from the definition
 given, with something like

 {{{
     if ((n == 4) or (n % 2 == 1 and n.is_prime_power()) or
         (n % 2 == 0 and n % 4 != 0 and (n//2).is_prime_power())):
         return ans
 }}}

 where each condition group matches exactly one of the classes of allowed
 arguments in the docstring.  I find this is also marginally faster on
 average for successful calls.  But I think we should check n for the
 existence of a primitive root before we call pari, because when testing it
 I came across this (4.6.2):

 {{{
 sage: factor(1729)
 7 * 13 * 19
 sage: time primitive_root(1729)
 [... several minutes go by, so I have no idea if this eventually returns a
 value or not ...]
 }}}

 Similarly for 2465, 3458, 4930.  This is a pari bug not an interface bug,
 as working directly with the console shows the same issue.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10836#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
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-trac?hl=en.

Reply via email to