# Enigmatic Code

Programming Enigma Puzzles

## Enigma 972: Fifty-fifty

From New Scientist #2127, 28th March 1998

Bunko, Jack and Patience have a pack of cards that consists of fewer than one hundred cards which are numbered consecutively: 1, 2, 3, 4, 5, 6, …

On one occasion recently they were each given one of the cards (without the other two players seeing which).

Bunko said: “There’s an exactly 50:50 chance that my card is the highest of our three”.

Then Jack added: “In that case there’s an exactly 50:50 chance that, in decreasing order, the cards are Bunko’s, Patience’s then mine”.

How many cards are there in the pack? And what was Jack’s card?

[enigma972]

### One response to “Enigma 972: Fifty-fifty”

1. Jim Randell 21 February 2020 at 8:35 am

This Python program runs in 83ms.

Run: [ @repl.it ]

```from enigma import irange, fraction, printf

# consider possible number of cards
for n in irange(7, 99):

# suppose B was dealt card b
for b in irange(1, n):

# the probability of the two other cards being lower is:
# ((b - 1) / (n - 1)) * ((b - 2) / (n - 2))
# = (b - 1) (b - 2) / (n - 1) (n - 2)
# and this should be 1/2
if fraction((b - 1) * (b - 2), (n - 1) * (n - 2)) == (1, 2):

printf("(1) n={n} b={b}")

# suppose J was dealt card j
for j in irange(1, b - 1):

# the probability that the remaining card is between these two is:
# (b - j - 1) / (n - 2)
# and this should be 1/2
if fraction(b - j - 1, n - 2) == (1, 2):

printf("  (2) j={j}")
```

Solution: There were 22 cards in the pack. Jack’s card was 5.

Bunko’s statement can only be true if there are 22 cards in the pack, and he was dealt card 16.

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