#13516: prime_powers doesn't work with start very well
---------------------------------+------------------------------------------
       Reporter:  kcrisman       |         Owner:  was       
           Type:  defect         |        Status:  needs_work
       Priority:  major          |     Milestone:  sage-5.4  
      Component:  number theory  |    Resolution:            
       Keywords:  beginner       |   Work issues:            
Report Upstream:  N/A            |     Reviewers:            
        Authors:  Kevin Halasz   |     Merged in:            
   Dependencies:                 |      Stopgaps:            
---------------------------------+------------------------------------------
Changes (by dimpase):

  * status:  needs_review => needs_work


Comment:

 The comment on line 708 in {{{sage/rings/arith.py}}} needs to be fixed,
 too - it talks about primes rather than prime powers.

 I also think that the following:
 {{{
        sage: prime_powers(10,7)
         761             Traceback (most recent call last):
         762             ...
         763             ValueError: the first input must be less than the
 second input, however, 10 > 7
 }}}
 i.e. the corresponding implementation logic is not right, in the sense
 that it should just return empty lists rather than throwing exceptions.
 And negative {{{start}}}  should be allowed too (cf. the semantics of
 {{{range()}}}).

 Then, in the following fragment
 {{{
         783         output = prime_range(start,stop)
         784         if start == 1:
         785             output.append(1)
         786
         787         s = stop.sqrt()
         788         for p in prime_range(stop):
 }}}
 {{{prime_range()}}}, which is not cheap, is basically called two times
 instead of one.
 One can do with one call to {{{prime_range(stop)}}} just fine.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13516#comment:11>
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