Multipartitions of a multiset in Sage

asked 2020-10-07 05:37:40 -0500

GA3165 gravatar image

Let L = [0,1,1,2,2,2,2,]. I want to generate all the multi-partitions of L in which each part can have repeated entries and the parts themselves can repeat in the partition.

For example, [[0],[1,2],[1,2],[2,2]] is one such partition of L.

Kindly help me with this. Thank you.

edit retag flag offensive close merge delete

Comments

Generate partitions of list(range(len(L))) and apply $k \mapsto L[k]$ to each element in each part?

rburing gravatar imagerburing ( 2020-10-07 13:36:14 -0500 )edit

@rburing. Thank you. It works. Cute idea.

GA3165 gravatar imageGA3165 ( 2020-10-07 22:23:09 -0500 )edit