Is it this: >>> n=3 >>> print filldedent(flatten([list(set(permutations(c))) for c in combinations_w ith_replacement(range(n),n) if sum(c) == n-1], 1))
[(0, 2, 0), (0, 0, 2), (2, 0, 0), (0, 1, 1), (1, 1, 0), (1, 0, 1)] >>> n=4 >>> print filldedent(flatten([list(set(permutations(c))) for c in combinations_w ith_replacement(range(n),n) if sum(c) == n-1], 1)) [(0, 0, 0, 3), (0, 3, 0, 0), (0, 0, 3, 0), (3, 0, 0, 0), (0, 0, 2, 1), (0, 2, 0, 1), (0, 2, 1, 0), (0, 0, 1, 2), (2, 0, 0, 1), (1, 0, 2, 0), (2, 0, 1, 0), (1, 2, 0, 0), (1, 0, 0, 2), (0, 1, 2, 0), (0, 1, 0, 2), (2, 1, 0, 0), (1, 0, 1, 1), (1, 1, 0, 1), (0, 1, 1, 1), (1, 1, 1, 0)] /c -- You received this message because you are subscribed to the Google Groups "sympy" 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/sympy?hl=en.
