# Enigmatic Code

Programming Enigma Puzzles

## Tantalizer 499: Kid’s stuff

From New Scientist #1050, 5th May 1977 [link]

Professor Plato once introduced two strangers to each other by saying, “Mrs. Um, I’d like you to meet Mrs. Er, seeing that you are both perfect logicians and mothers with 9 or 10 children between you.”

“How many children do you have?” asked Mrs. Um.
“How many do you have?” Mrs. Er countered.
“How many do you have?” Mrs. Um repeated.
“How many do you have?” retorted Mrs. Er.
“How many do you have?” Mrs. Um persisted.
“How many do you have?” Mrs. Er returned.
“How many do you have?” inquired Mrs. Um.
“How many do you have?” reposted Mrs. Er.

The ladies now fell silent, since, as everyone knows, perfect logicians do not ask questions which they can already answer.

If at least one lady had an even number of children, how many did each have?

[tantalizer499]

### 3 responses to “Tantalizer 499: Kid’s stuff”

1. Jim Randell 26 October 2016 at 9:27 am

This is a similar problem to Enigma 36 and Enigma 183 (both also set by Martin Hollis).

Here is the setters solution:

Answer: A 4; B 5.

Q1 rules out A9; Q2 rules out B9 and B1; Q3 A8 and A1; Q4 B8 and B2; Q5 A7 and A2; Q6 B7 and B3; Q7 A6 and A3; Q8 B6 and B4. In general the number depends on how much more than the difference between the possible totals each lady has. (I hope this atones for an earlier Tantalizer where this problem came unstuck).

And here is my programmed solution. This Python program uses the [[ `filter_unique()` ]] function from the enigma.py library. It runs in 44ms.

```from enigma import irange, filter_unique, printf

# possible pairs of children
pairs = list()
# total is 9 or 10
for t in irange(9, 10):
# A's children
for a in irange(1, 9):
b = t - a
if b > 0:
pairs.append((a, b))

# A asks a question of B
def question(A, B):
# remove (a, b) pairs which uniquely identify b
(X, A) = filter_unique(A, lambda v: v[0], lambda v: v[1])
# remove any pairs from B with the deleted values for A
X = list(v[0] for v in X)
B = filter((lambda v: v[1] not in X), B)
# return new values for A and B
return (A, B)

# initial possibilities for each mother
U = E = pairs

# there are four pairs of questions asked
for _ in irange(1, 4):
# first U asks a question
(U, E) = question(U, E)
# then E asks a question
(E, U) = question(E, U)

# so the possibilities for U and E are...
for (u, e) in set(U).intersection((b, a) for (a, b) in E):
# but (at least) one of them must be even
s = (' [*** SOLUTION ***]' if u % 2 == 0 or e % 2 == 0 else '')
printf("U={u} E={e}{s}")
```

Solution: Mrs. Um has 4 children. Mrs. Er has 5 children.

And here is my analytical solution. (Which is basically what the program is doing).

To start with each mother knows how many children they have themselves (I hope), and we are told that in total they have 9 or 10 children.

So if U has 9 children, she knows that E must have 1 child. We denote this: U: 9 → 1.

And if U has 1 child, she knows that must have either 8 or 9 children. We denote this: U: 1 → 8,9.

The full list of possibilities is:

[0] Initially:

U: 1 → 8,9; 2 → 7,8; 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 2,3; 8 → 1,2; 9 → 1
E: 1 → 8,9; 2 → 7,8; 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 2,3; 8 → 1,2; 9 → 1

[1] U asks a question, so U does not know for sure how many children E has, so U cannot have 9 children, we remove the possibilities where U has 9 children:

U: 1 → 8,9; 2 → 7,8; 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 2,3; 8 → 1,2
E: 1 → 8; 2 → 7,8; 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 2,3; 8 → 1,2; 9 → 1

[2] E asks a question, so E does not know for sure how many children U has, so E cannot have 1 or 9 children:

U: 1 → 8; 2 → 7,8; 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 2,3; 8 → 2
E: 2 → 7,8; 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 2,3; 8 → 1,2

[3] U asks a question, so U does not know for sure how many children E has, so U cannot have 1 or 8 children:

U: 2 → 7,8; 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 2,3
E: 2 → 7; 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 2,3; 8 → 2

[4] E asks a question, so E does not know for sure how many children U has, so E cannot have 2 or 8 children:

U: 2 → 7; 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 3
E: 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 2,3

[5] U asks a question, so U does not know for sure how many children E has, so U cannot have 2 or 7 children.

U: 3 → 6,7; 4 → 5,6; 5 → 4,5; 6 → 3,4
E: 3 → 6; 4 → 5,6; 5 → 4,5; 6 → 3,4; 7 → 3

[6] E asks a question, so E does not know for sure how many children U has, so E cannot have 3 or 7 children.

U: 3 → 6; 4 → 5,6; 5 → 4,5; 6 → 4
E: 4 → 5,6; 5 → 4,5; 6 → 3,4

[7] U asks a question, so U does not know for sure how many children E has, so U cannot have 3 or 6 children.

U: 4 → 5,6; 5 → 4,5
E: 4 → 5; 5 → 4,5; 6 → 4

[8] E asks a question, so E does not know for sure how many children U has, so E cannot have 4 or 6 children.

U: 4 → 5; 5 → 5
E: 5 → 4,5

[9] U does not ask a further question as she now knows that E has 5 children.

But I don’t think E can know, at this point, how many children U has (they must have either 4 or 5).

However, we are now told that at least one lady has an even number of children, so U must have 4 children.

2. Tessa Fullwood 2 November 2016 at 9:27 pm

Interested that this puzzle is counter-intuitive. I’m glad that I reached the answer 4,5. Statement [9] seems right, and U only has 4 children since we are told that one lady has an even number of children. Could Professor Plato end with “with a DIFFERENT NUMBER OF CHILDREN, but 9 or 10 children between you.”

3. Jim Randell 4 November 2016 at 3:11 pm

@Tessa: If Professor Plato had introduced them as having a different number of children then the pair (U=5, E=5) is not possible and so we would get:

[0] Initially:

U: 1 → 8,9; 2 → 7,8; 3 → 6,7; 4 → 5,6; 5 → 4; 6 → 3,4; 7 → 2,3; 8 → 1,2; 9 → 1
E: 1 → 8,9; 2 → 7,8; 3 → 6,7; 4 → 5,6; 5 → 4; 6 → 3,4; 7 → 2,3; 8 → 1,2; 9 → 1

[1] U asks a question. We remove the possibilities where U has only one choice (U=5, U=9):

U: 1 → 8,9; 2 → 7,8; 3 → 6,7; 4 → 5,6; 6 → 3,4; 7 → 2,3; 8 → 1,2
E: 1 → 8; 2 → 7,8; 3 → 6,7; 4 → 6; 5 → 4; 6 → 3,4; 7 → 2,3; 8 → 1,2; 9 → 1

[2] E asks a question. We remove the possibilities where E has only one choice (E=1, E=4, E=5, E=9):

U: 1 → 8; 2 → 7,8; 3 → 6,7; 4 → 6; 6 → 3; 7 → 2,3; 8 → 2
E: 2 → 7,8; 3 → 6,7; 6 → 3,4; 7 → 2,3; 8 → 1,2

[3] U asks a question. We remove the possibilities where U has only one choice (U=1, U=4, U=6, U=8):

U: 2 → 7,8; 3 → 6,7; 7 → 2,3
E: 2 → 7; 3 → 7; 6 → 3; 7 → 2,3; 8 → 2

[4] E asks a question. We remove the possibilities where E has only one choice (E=2, E=3, E=6, E=8):

U: 2 → 7; 3 → 7;
E: 7 → 2,3

At this point U would know that E must have 7 children, so wouldn’t ask a further question. E would know that U must have 2 or 3 children but without additional information wouldn’t know which case applies.

So we would only have a sequence of 4 questions.

Again if we are told that one of the ladies has an even number of children we can deduce at this point that U=2 and E=7.

This site uses Akismet to reduce spam. Learn how your comment data is processed.