2
$\begingroup$

Three perfect logicians named A, B and C each select a positive integer and report their number to Mufti.

Mufti writes the sum of the three numbers on one card and the product of the three numbers on another card. Mufti hides one of the cards and shows them the other card. They do not know which card Mufti has shown them. The card shows the number 36.

The three logicians A, B and C then have the following conversation:

A states: 'I do not know B or C's number, but I know that their numbers are different'.

B then states: 'I do not know A or C's number, but I know that their numbers are different'.

C then states: 'I do not know A or B's number, but I know that their numbers are different'.

B then states: 'Now I know both A and C's number!'

C then states: 'Now I know both A and B's number!'

What numbers did the three logicians choose?

$\endgroup$
1
  • $\begingroup$ This is an excellent question for my taste now, after the slight change, it is so because the guess component does not exist, this is a perfect mathematical problem also, and may serve for didactic purposes (in both mathematics and informatics, even for very young puzzle solvers)... upvoted! $\endgroup$
    – dan_fulea
    Commented Jun 23 at 14:09

2 Answers 2

3
$\begingroup$

To write down the solution, i need some notations. There are three perfect logicians involved, Adam, Beatrix, and Caesar, but since the solution will be doubled by code, $0,1,2$ in this order may be used instead.


There are $631$ possible configurations $c=(c_0,c_1,c_2)$ of positive integer numbers with either the sum or the product equal to $36$. They form a set $C$.


There are four points on the time line, where we can record information.

  • point 0 is the start, before the statement of Adam.
  • point 1 is after the statement of Adam, before the first statement of Beatrix.
  • point 2 is after the first statement of Beatrix, before the first statement of Caesar.
  • point 3 is after the first statement of Caesar, before the second and last statement of Beatrix.
  • point 4 is after the last statement of Beatrix, before the last statement of Caesar.
  • point 5 is the final, after the last statement of Caesar.

The set of possible configurations for a neutral observer Xenia at time $k$ will be denoted by $C_k=C_{Xk}$. So $C_0=C$.

Since each of the logicians A, B, C has (potentially) more information at any point, we denote by $C_{Ak}$, $C_{Bk}$, $C_{Ck}$ respectively the possible configurations from their point of view at point $k$ on the time line.

The supplementary information is the chosen value, and i need a new letter for these three values in the arguments, they are $v_A=v_0$, $v_B=v_1$, and $v_C=v_2$. Then we have: $$ \begin{aligned} C_{Ak} &= \{\ c=(c_0,c_1,c_2)\in C_k=C_{Xk}\ :\ c_0=v_0\ \}\ ,\\ C_{Bk} &= \{\ c=(c_0,c_1,c_2)\in C_k=C_{Xk}\ :\ c_1=v_1\ \}\ ,\\ C_{Ck} &= \{\ c=(c_0,c_1,c_2)\in C_k=C_{Xk}\ :\ c_2=v_2\ \}\ . \end{aligned} $$ We need a notation for the projection of the configurations $C_k$ on the one or the other component, we obtain the set of values of the components A, B, C at time $k$: $$ \begin{aligned} V_{Ak} &= \{\ c_0\ :\ \text{ there is a }c=(c_0,c_1,c_2)\in C_k\ \}\ ,\\ V_{Bk} &= \{\ c_1\ :\ \text{ there is a }c=(c_0,c_1,c_2)\in C_k\ \}\ ,\\ V_{Ck} &= \{\ c_2\ :\ \text{ there is a }c=(c_0,c_1,c_2)\in C_k\ \}\ . \end{aligned} $$



At point 0 we have as neutral observer Xenia a set $C=C_0$ of $631$ elements. There is nothing more to say in Xenia's position.

Now Adam makes his claim. The perfect logicians Beatrix and Caesar silently say to themselves "What a blabbermouth... <i do not know the numbers, but they are different> - of course you do not know the numbers, given that they are different after all, if $(c_0,c_1,c_2)$ is a solution, then $(c_0,c_2,c_1)$ is also a solution...". But ok, each of them takes the view of Xenia, which is an important view, and compute the set $C_1$. It turns out that the values of Adam so far may be only the odd numbers from the list $$ V_{A1}=\{3, 5, 7, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33\}\ , $$ the values $1,9,36$ must be excluded since $(1,6,6)\in C_0$ and $(9,2,2)\in C_0$ and $(36,1,1)\in C_0$. Also, all other even values must be excluded.


From $V_{A1}$ we build $C_1$, the set of configurations in $C$ with a first component in $V_{A1}$. Now Beatrix makes her claim. She makes it in the first part with a smiling intonation in her voice, that "" with a glance to Adam, then she finally insures that from the B-perspective we have $c_0\ne c_2$.

And here is the list of the possible values of Beatrix after her claim: $$ V_{B2} = \{1, 3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 27, 28, 29\}\ . $$ All odd positive integers up to $29$ must be considered. They do not divide $36$, which insures that we see the sum $36$ in Muftis decision. Then the sum $c_0+c_2$ is odd, so $c_0\ne c_2$. The odd values $31,33,35$ must be discarded. Why? For $31$ we have $c_0\in\{3,5,\dots\}$, but only $3$ leads to a solution, when Beatrix would know the configuration $(3,31,2)$. (In particular, she is not a chatterbox.) Then $33,35$ are too big already.

The $1$ is possible, since $(1,6,6)$ is already excluded in Xenia's view.

The $9$ is possible, since $(9,2,2)$ is already excluded in Xenia's view.

Some even values are also possible. Such even values must have a $c_1$ divisible by $4$, so that $c'=(36-c_1)/2$ is also even, and excluded from $V_{A1}$. Else $(c',c_1,c')$ would be a candidate. We consider closer the numbers $4,8,12,16,20,24,28,32$. Among them, we must exclude $4,32$ because of $(3,4,3)\in C_1$ for the $4$, and because of the only one possibility $(3,32,1)$ for $32$.


Now Caesar makes its claim. It turns out that its possible values are after the claim $$ V_{C3}=\{1, 3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 18, 20, 21, 24, 28\}\ . $$ Odd values up to $17$, together with $21$ are all possible. Why do we allow $1,9$? Because $6,2\not\in V_{A1}$. Why is $19$ not in the list? Because only $(5,12,19)$ is a match! Why is $23$ not in the list? Because only $(5,8,23)$ is a match! Why is $25$ not in the list? Because only $(3,8,25)$ is a match! And for $c_2=27,29,31,33$ there is no match using $c_1\in V_{A1}$ and $c_2\in V_{B2}$.

What about the even values? The following elements are in $C_2$,

$(17,17,2)$, $(3,3,4)$, $(15,15,6)$, $(13,13,10)$, $(11,11,14)$, $(7,7,22)$, $(5,5,26)$, $(3,3,30)$.

So the third component is excluded from $V_{C3}$. We also exclude $32$ with the unique match $(32,3,1)$. The remained even values are valid.


We have now the decisive claim of Beatrix!

The allowed configurations after it are exactly: $$ \bbox[yellow]{\qquad C_4=\{(3, 25, 8),\ (5, 19, 12),\ (5, 23, 8)\}\ . \qquad} $$ For Caesar we have only $8$ and $12$ (as last component) possible.


Finally, Caesar can distinguish between the cases, with his information. If he owned the $8$, no decision would be possible. The $12$ is the only value with a single matching projection. The solution is thus the one element of the final configuration list: $$ \bbox[yellow]{\qquad C_5=\{(5, 19, 12)\}\ . \qquad} $$ So the choices were: Adam $\bf 5$, Beatrix $\bf 19$, Caesar $\bf 12$.



Computer support: The following sage code finds the solution, variables in the code are similar to the ones used above. (I can easily write the equivalent python code, if wanted.)

R = [1..36]
RRR = cartesian_product([R, R, R])

C0 = [c for c in RRR 
      if sum(c) == 36 or prod(c) == 36]    # 631 different list elements

VA0 = list(set(c[0] for c in C0))
VA1 = [v0 for v0 in VA0 
       if 1 < len([c for c in C0 if c[0] == v0])
       and not [c for c in C0 if c[0] == v0 and c[1] == c[2]]]
   
C1 = [c for c in C0 if c[0] in VA1]

VB1 = list(set(c[1] for c in C1))
VB2 = [v1 for v1 in VB1 
       if 1 < len([c for c in C1 if c[1] == v1])
       and not [c for c in C1 if c[1] == v1 and c[0] == c[2]]]

C2 = [c for c in C1 if c[1] in VB2]

VC2 = list(set(c[2] for c in C2))
VC3 = [v2 for v2 in VC2
       if 1 < len([c for c in C2 if c[2] == v2])
       and not [c for c in C2 if c[2] == v2 and c[0] == c[1]]]

C3 = [c for c in C2 if c[2] in VC3]

VB3 = list(set(c[1] for c in C3))
VB4 = [v1 for v1 in VB3
       if 1 == len([c for c in C3 if c[1] == v1])]

C4 = [c for c in C3 if c[1] in VB4]

VC4 = list(set(c[2] for c in C4))
VC5 = [v2 for v2 in VC4
       if 1 == len([c for c in C4 if c[2] == v2])]

C5 = [c for c in C4 if c[2] in VC5]

print(C5)

And the print gives:

[(5, 19, 12)]
$\endgroup$
1
  • $\begingroup$ I have now slightly modified my question to give a unique answer. $\endgroup$
    – Cristof012
    Commented Jun 23 at 7:07
0
$\begingroup$

Rewriting an answer for this. The logic ends up pretty hairy, and it doesn't seem like the answer is unique. EDIT: with the change, there is a trivial final step.

A has 5, B has 19, and C has 12.

Prior to the final statement, C has 8 if B has 23 or 25, or C has 12 if B has 19. At that point, for it to be unambiguous to C, he/she must have 12.

After A's statement:

A has 3, 5, 7, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, or 33. Basically, only odds and no 1 or 9.

After B's statement:

B has 1, 3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 27, 28, or 29. Same in that odds are generally good, but some 0 mod 4s are ok too, as well as 18 (because A can't be 9). The higher odds are out because B will know one of the others' number.

After C's statement:

C has 1, 3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 18, 20, 21, 24, or 28. Mostly working with pairs above, and a lot of the same concepts.

Now B has figured out the answer, so we can go through the B candidates and figure out which have a uniquely defined A and C associated with them

It makes sense to start with the larger Bs, since those reduce the pool of As and Cs. From what I can tell, 3-25-8 and 5-23-8 works for all the statements and gives C is 8. But 5-19-12 also fits the bill, I think.

$\endgroup$
1
  • $\begingroup$ I have now slightly modified my question to give a unique answer $\endgroup$
    – Cristof012
    Commented Jun 23 at 7:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.