#5415: wrong definition of multifactorial?
------------------------------+---------------------------------------------
 Reporter:  cwitty            |       Owner:  robertwb  
     Type:  defect            |      Status:  new       
 Priority:  major             |   Milestone:  sage-4.1.1
Component:  basic arithmetic  |    Keywords:            
 Reviewer:                    |      Author:            
   Merged:                    |  
------------------------------+---------------------------------------------

Comment(by jhpalmieri):

 I think the problem is that not enough factors are included.  Actually,
 there are two problems: in the base case, it should return n, not 1; that
 is, make this change:
 {{{
          # base case
          if 0 < n < k:
 -            return ONE
 +            return n
 }}}
 After making this change, I'm still getting the wrong answers for
 {{{a.multifactorial(3)}}} whenever a is congruent to 2 mod 3 (except for
 a=2), and for {{{a.multifactorial(4)}}} whenever a is congruent to 2 or 3
 mod 4 (except for a=2,3).  It seems that not enough factors are used; for
 example, 10.multifactorial(4) should be 10 x 6 x 2 = 120, but Sage
 computes it as 10 x 6 = 60.

 If we fix this, we can put in doctests like the following:
 {{{
 sage: L = sloane_sequence(6882)[2]  # optional - internet
 Searching Sloane's online database...
 sage: all([Integer(a).multifactorial(2) == L[a] for a in range(1,20)])
 # optional - internet
 True
 }}}

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