I have a list [1,2,3,4,5,6,7,8,9]
and I would like to get all the lists that arise as a result of grouping its elements in pairs and a solitary one, regardless of the order of the pairs. That is, I expect something like:
[[1,2],[3,4],[5,6],[7,8],[9]],
[[1,2],[3,4],[5,6],[7,9],[8]],
[[1,2],[3,4],[5,6],[8,9],[7]],
[[1,2],[3,4],[5,7],[6,8],[9]],
[[1,2],[3,4],[5,7],[6,9],[8]],
...
As @abulafia indicates, the total number of lists in the case of 9 elements would be:
C(9,2) * C(7,2) * C(5,2) * C(3,2)
where C(n,m) are the combinations of n elements taken from m to m. With 22680 possibilities as a result, quite far from the 36 that it indicated.
A greeting and thanks in advance