### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,367)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (48)
- site news (58)
- tantalizer (94)
- teaser (7)

### Site Stats

- 233,129 hits

Programming Enigma Puzzles

11 January 2020

Posted by on **From New Scientist #3264, 11th January 2020** [link]

Ten friends have rented a dormitory for the night of a hen party. Each person picks a bed for the night before heading out on the town. At 2 am they start heading home a little the worse for wear.

Amy, the first to arrive back at the dorm, can’t remember which bed she chose, so she picks one at random. The next person to return, Bethan, heads for her own bed, but if she finds it has already been taken, she randomly picks another.

The remaining friends adopt the same approach of going to their bed if it is available and randomly picking another if it isn’t. Janice is the last to get home. What is the chance that her own bed is still empty? And was Janice more or less likely to find the bed she first chose empty than Iona, who got back just before her?

[puzzle#41]

%d bloggers like this:

This Python 3 program generates all possible outcomes, along with their probabilities and then sums the probabilities where each girl occupies her original bed. It runs in 109ms.

Run:[ @repl.it ]Solution:The chance that Janice finds her original bed unoccupied is 1/2. The chance that Iona finds her original bed unoccupied is 2/3, so it is less likely that Janice finds her original bed unoccupied.The probability that the described strategy results in each girl ending up in her original bed is: