I have the following example:
data={1, 2, 3, 4, 5, 6, 7, 8, 9};
NN=Length[data]/3;
subdata=Subsets[data, {3}];
I want to know all the possibility for the following rules:
pick up NN=3
terms from the subdata
:
select1={{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
select2={{1, 2, 4}, {3, 5, 7}, {6, 8, 9}};
select3={{1, 2, 5}, {3, 4, 8}, {6, 7, 9}};
select4={{1, 2, 6}, {3, 4, 7}, {5, 8, 9}};
Condition1: every list such as select2
forms one permutation such as data
and no repeated terms in all the selectlists (select1
, select2
, select3
, select4
).
Condition2: Every term in the whole selectlists can only be used for one time. That means randomly pick NN=3
terms from selectlists (select1
, select2
, select3
, select4
), except the lists itself I should not have any permutations. Please see the following example which doesn't fufill:
select1={{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
select2={{1, 2, 4}, {3, 5, 7}, {6, 8, 9}};
select3={{1, 2, 5}, {3, 4, 8}, {6, 7, 9}};
select4={{1, 2, 6}, {3, 4, 7}, {5, 8, 9}};
I can chose three terms from select3, select4 and select2 such that {{1, 2, 5}, {3, 4, 7}, {6, 8, 9}}
form one permutation again. So select4={{1, 2, 6}, {3, 4, 7}, {5, 8, 9}}
should be changed to something like select4={{1, 2, 7}, {3, 4, 9}, {5, 6, 8}}
where there is no possible way to form one permutation except the lists itself.
select1={{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
select2={{1, 2, 4}, {3, 5, 7}, {6, 8, 9}};
select3={{1, 2, 5}, {3, 4, 8}, {6, 7, 9}};
select4={{1, 2, 7}, {3, 4, 9}, {5, 6, 8}};
I want to know the maximal number forming selectN (N=?) where all the lists selectN fulfill Condition1 and Condition2
I know the following case:
data={1, 2, 3, 4, 5, 6}; NN=Length[data]/3; subdata=Subsets[data, {3}];
I can get the maximal number selectN (N=10) by counting manually which fufill Condition1 and Condition2.
selects={{{1, 2, 3}, {4, 5, 6}}, {{1, 2, 4}, {3, 5, 6}}, {{1, 2, 5}, {3, 4, 6}}, {{1, 2, 6}, {3, 4, 5}}, {{1, 3, 4}, {2, 5, 6}}, {{1, 3, 5}, {2, 4, 6}}, {{1, 3, 6}, {2, 4, 5}}, {{1, 4, 5}, {2, 3, 6}}, {{1, 4, 6}, {2, 3, 5}}, {{1, 5, 6}, {2, 3, 4}}}
But when the data gets larger, it's difficult to count without programming. Thank you for any suggestions!
select5 = {{1, 2, 9}, {1, 2, 8}, {5, 8, 9}}
fulfills condition 1? (Since the total is 45) $\endgroup$select1 = {{1,2,3},{4,5,6},{7,8,9}}; select2 = {{1,2,3},{4,5,7},{6,8,9}}
fulfill condition 2? (Since I can select{1,2,3}
fromselect1
and{4,5,7}
,{6,8,9}
fromselect2
) $\endgroup$