Counting the Conway-like Solutions of the 12-Coin Problem

combinatoricsrecreational-mathematics

Let $W$ be the set of all $3 \times 12$ matrices $F$ with elements in $\{A,B,C\}$ such that:

(i) no two distinct columns of $F$ are equal,

(ii) for any two distinct columns $F^{i}$, $F^{j}$ of $F$, $F^{i}$ is not obtained by $F^{j}$ by replacing $A$ with $B$, $B$ with $A$, and leaving $C$ unchanged (we say that $F^{i}$ and $F^{j}$ are not "complementary");

(iii) each row of $F$ contains exactly four $A$'s, four $B$'s and four $C$'s.

Let then $S$ be the subset of $W$ consisting of all the matrices $F$ which also satisfy:

(iv) no column of $F$ contains only $C$'s.

The sets $W$ and $S$ occur in the solution of the famous problem of the 12 coins. To see how, let us first recall that the great mathematician John Conway found an extremely elegant solution to this problem, which you can read at the page Il famoso problema delle 12 monete (the page is in Italian, but it contains a copy of the original answer by Conway).

Following Conway's idea, I have been trying to find all the possible "Conway-like" solutions of the 12-coin problem in the following way. Each $3 \times 12$ matrix $F$ with elements in $\{A,B,C\}$ defines an arrangement for the three weighings in the following way: coin $j$ is in the left (right, no) plate in the $i$-th weighing if the element $F_{ij}$ of $F$ is equal to $A$ (respectively $B$, $C$).

Then a matrix in $S$ defines an arrangement for the three weighings which allows you to identify the different coin and to say whether it is lighter or heavier, while a matrix in $W$ defines an arrangement for the three weighings which allows you to identify the different coin, but when it comes up to be the $j$-th one, with the the $j$-th column of $F$ containing only $C$'s, you cannot say whether it is heavier or lighter. So we can call an element of $W$ a "weak solution" of the 12-coin problem, and an element of $S$ a "strong solution" of the 12-coin problem.

$\textbf{Problem I}$ What are the cardinalities of $W$ and $S$?

$\textbf{Problem II}$ Maybe, a more interesting way of counting the possible arrangements of the coins in the three weighings is to consider immaterial the individual identities of the coins, the order of the weighings, and the distinction between left and right plate of the balanace. This leads us to the more difficult question of computing the number of equivalence classes of $W$ and $S$ under the following equivalence relation: two $3 \times 12$ matrices $F, G$ with elements in $\{A,B,C\}$ are considered to be equivalent if $F$ can be reduced to $G$ by a permutation of the rows, a permutation of the columns and by eventually replacing each $A$ with $B$ and each $B$ with $A$ in a row (clearly this operation can be executed for none, one, two or three rows). To find the number of solutions in this last case seems to me pretty hard.

Thank you very very … much in advance for your attention.

Best Answer

The following integer linear programming formulation eliminates symmetry with respect to columns.

For each of the $3^3=27$ words $(i,j,k)$ of length three on $\{A,B,C\}$, let binary decision variable $x_{i,j,k}$ indicate whether the word is selected as one of the columns. We want to find all solutions to the linear constraints \begin{align} \sum_{i,j,k} x_{i,j,k} &= 12 \tag1 \\ x_{i,j,k} + x_{\bar{i},\bar{j},\bar{k}} &\le 1 &&\text{for all complements $(i,j,k)$ and $(\bar{i},\bar{j},\bar{k})$} \tag2 \\ \sum_{j,k} x_{\ell,j,k} &= 4 &&\text{for $\ell \in \{A,B,C\}$} \tag3 \\ \sum_{i,k} x_{i,\ell,k} &= 4 &&\text{for $\ell \in \{A,B,C\}$} \tag4 \\ \sum_{i,j} x_{i,j,\ell} &= 4 &&\text{for $\ell \in \{A,B,C\}$} \tag5 \end{align} Constraint $(1)$ selects exactly $12$ words. Constraint $(2)$ prevents complementary pairs from being selected. Constraints $(3)$ through $(5)$ select exactly $4$ of each letter in each position.

There are $520$ solutions, $304$ of which do not include $CCC$. Here is one of the the $304$ solutions, with one column per word:

A A A A B B B B C C C C 
B C C C A B B B A A A C 
C A B C B A B C A B C A 
Related Question