Ask Your Question

Revision history [back]

Where have you searched!?

sage: for s in SetPartitions([1,2,3,4,5], 3):
....:     print(s)
{{1, 4, 5}, {2}, {3}}
{{1, 5}, {2, 4}, {3}}
{{1, 5}, {2}, {3, 4}}
...
{{1, 2, 3}, {4}, {5}}