binary counting for all possible combinations of elements
2013-12-01azim58 - binary counting for all possible combinations of elements
If there are several elements which can be either included or not
included to form a group, then all possible groups can be generated by
simply counting in binary from 1 to 2^(# of elements).
One way of doing this could be to use excel. Let's say we have 3
elements. In excel we would count from 1 to 8. Then we would convert
these numbers to binary (DEC2BIN function). Then we could put the leading
0s in front of these binary elements by repasting the numbers so they
don't include any formulas then format cells->custom->000#. These numbers
could be turned into a matrix if desired by using a regex to
f
(\d)
r
$1\t
Then headers could be placed at the top of each column. The final result
might look something like this.
element 1
element 2
element 3
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
1
0
0
1
1
1
1
0
0
0