user15916149
user15916149

Reputation:

Generation of particular combinations

In Mathematica I implemented this simple code:

n = 8;
a0 = Range[0, n - 1];
a1 = Subsets[a0, {2}];
a2 = Subsets[a1, {2}];
a3 = Select[a2, Length[Union[Flatten[#]]] == 4 &];
a4 = Subsets[a3, {n/4}];
a5 = Select[a4, Length[Union[Flatten[#]]] == n &];
a6 = Map[Flatten, a5, 1];

where n can take values ​​such as 4, 8, 12, 16, ...

The problem is that already with n = 12, you don't get anywhere, because the size of a4 becomes huge. What algorithm could be used to obtain a6 directly from a0 or n?

Upvotes: 0

Views: 32

Answers (1)

mkrieger1
mkrieger1

Reputation: 23250

Here is a meta algorithm:

  • Calculate the values of a6 for n = 0, 1, 2, 3, ...
  • Look up the resulting sequence on https://oeis.org/
  • Check whether the search results match your expectations and if there is a closed-form solution

Upvotes: 0

Related Questions