Ask Your Question
1

Multipartitions of a multiset in Sage

asked 2020-10-07 12:37:40 +0100

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

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-10-07 20:36:14 +0100

rburing gravatar image

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

edit flag offensive delete link more

Comments

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

GA3165 gravatar imageGA3165 ( 2020-10-08 05:23:09 +0100 )edit

@GA3165 -- I turned @rburing's comment into an answer.

You can accept it to mark the question as solved.

slelievre gravatar imageslelievre ( 2021-01-01 21:52:11 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-10-07 12:37:40 +0100

Seen: 303 times

Last updated: Oct 07 '20