The list of 5-element sets can you make with 2 elements?

74 Views Asked by At

Take the set $\{1,2\}$. I know there are $2^5 = 32$ different 5-element sets made up these two elements, but what are they?

I would like to create a $32 \times 5$ matrix in MATLAB or MuPad such that each row contains each set. For example the first row could be [1 2 2 1 1] and the second [2 2 2 1 1] etc.

I know these are neither combinations nor permutations, so what would you call such an arrangement? Thank you for your time!

1

There are 1 best solutions below

3
On BEST ANSWER

Here's a magical way to do this:

b = de2bi((0:31)') + 1;