On Tue, May 15, 2012 at 8:33 AM, tvn <nguyenthanh...@gmail.com> wrote: > I am wondering if Sage has some functions to generate the below > > given N,K (both are non-neg ints), return a set of tuples (n1...nk) such > that ni >= 0 and sum(ni)= N.
One way to do this is the following: sage: IntegerListsLex(5, length=2).list() [[5, 0], [4, 1], [3, 2], [2, 3], [1, 4], [0, 5]] --Mike -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.