I have following elements (in this example I have 12 elements, but generally it can be any set of 3, 12, 27, 48, 75, 108... elements conforming to $3 * m^2$ where $m\in N$):
$$A_1a_1, A_1b_1, A_2a_2, A_2b_2, A_3a_3, A_3b_3$$ $$B_1a_1, B_1b_1, B_2a_2, B_2b_2, B_3a_3, B_3b_3$$
I need to calculate all 2-combinations in this example (if I had 27 elements, I would need 3 combinations...) such that:
$$A_1a_1, B_1b_1$$
is valid combination, but
$$A_1a_1, A_2b_2$$
is not (element $A$ repeats in 2nd part) and neither is
$$A_1a_1,B_1a_3$$
where element $a$ repeats in second part.
Basically in this example, we can choose any of 12 elements on the first spot, but as soon as I choose one of 12, I remain with only 3 elements to select from. So if I choose $A_1a_1$ as first element, remaining elements that I can choose from are $B_1b_1, B_2b_2, B_3b_3$
Since these are combinations, selecting $A_1a_1, B_1b_1$ and selecting $B_1b_1, A_1a_1$ is the same combination.
In this particular case, there should be 18 combinations:
$ [A_1a_1,B_1b_1],[A_1a_1,B_2b_2],[A_1a_1,B_3b_3],[A_2a_2,B_1b_1],[A_2a_2,B_2b_2],[A_2a_2,B_3b_3],[A_3a_3,B_1b_1],[A_3a_3,B_2b_2],[A_3a_3,B_3b_3],[A_1b_1,B_1a_1],[A_1b_1,B_2a_2],[A_1b_1,B_3a_3],[A_2b_2,B_1a_1],[A_2b_2,B_2a_2],[A_2b_2,B_3a_3],[A_3b_3,B_1a_1],[A_3b_3,B_2a_2],[A_3b_3,B_3a_3] $
I guess there is a general formula for calculating these kind of combinatorial problems?