Saturday, November 27, 2021

The Ten Chests

Reasoning about probability can be very difficult. The puzzle herein is a follow-up of the last one I wrote about, which reminded me a bit of the famous Monty Hall problem. I managed to get the right answer to Smullyan's earlier puzzle without any assistance but it could have been because I already knew what to look for. Smullyan himself admitted that the solution is very counterintuitive and offered several separate justifications to combat intuition. Speaking of counterintuitive reasoning and probability, no less a person than the late Paul Erdős was unconvinced of the optimal decision in the Monty Hall problem until he witnessed a numerical simulation! In the same spirit, I will be applying a Monte Carlo simulation to the following more elaborate version of the previous puzzle:
It took Scheherazade quite a bit of time to get the king to accept the correct answer to the last problem, but she finally succeeded.
"I have thought of a related problem," said Scheherazade. "Suppose we have now ten chests instead of three, and each chest has three drawers. Each of the thirty drawers contains either a diamond, an emerald, or a ruby. They are dispersed in the following manner:
  1. D D D
  2. D D E
  3. D D R
  4. D E E
  5. D E R
  6. D R R
  7. E E R
  8. E R R
  9. E E E
  10. R R R
[Of course, D stands for diamond; E for emerald; and R for ruby. So for example, Chest 4 contains one diamond and two emeralds; Chest 7 contains two emeralds and one ruby. There are ten jewels of each of the three types, and they are distributed in all ten possible ways.]
"You open one of the thirty drawers at random and find a diamond. Then you open another drawer of the same chest. What is the probability that it also contains a diamond?"
I will use the power of simulation to attain a nearly perfect answer, like so:

The most recent run outputting 0.5020185586888407 was extremely close to the analytical solution given by the author of ½. Monte Carlo simulations are really something else.

The Three Chests

[Context: the late Raymond Smullyan's The Riddle of Scheherazade: And Other Amazing Puzzles takes place in a setting very like the Thousand and One Nights, except Shahrazad (or whatever Romanization you prefer) has failed to slake the mad king Shahryar's bloodlust and now she has to entertain him with puzzles to save her skin and the kingdom.]
Scheherazade began: "Auspicious King, Abdul the Jeweler has in his home three chests of drawers; each chest contains two drawers. In one of the chests, each drawer contains a ruby. In another of the chests, each drawer contains an emerald, and in the third chest, one drawer contains a ruby and the other drawer contains an emerald. Suppose you pick one of the three chests at random and open one of the drawers and find a ruby. What is the probability that the other drawer in the same chest will also contain a ruby?"
"Let me see now," said the king. "Oh yes, the chances are fifty percent." 
"Why?" asked Scheherazade.
"Because, once you open a drawer and find a ruby, then the chest with both emeralds is ruled out, and so you have either hit the mixed chest, or the chest with the two rubies, and so the chances are even."
Was the king right?

(Source: The Riddle of Scheherazade: And Other Amazing Puzzles by Raymond Smullyan) 

The king was not right but perhaps on the right track. It is true that the chest with two emeralds is ruled out entirely. What he missed is that there are not two but three possible events: one in which the mixed chest has a ruby picked out and two in which one or the other drawer of the chest with only rubies is opened. If that doesn't make immediate sense, consider whether the king's postulated 50% chance would apply if the chest of only rubies had ten drawers instead of only two!

Not A Puzzle for the Health Addict

The answer to this one wasn't quite satisfactory as you'll see below but I felt like solving it anyway because it was pretty funny:
A man buys a carton of 200 cigarettes, and every day he smokes seven cigarettes less than the day before. Eventually the day arrives when his quota is down to one cigarette—which happens to be all that there is left in the original carton. 
How many a day was he smoking he bought the carton?

(Source: Math and Logic Puzzles for the PC Enthusiast by J.J. Clessa)

This puzzle is another one where one has to work backwards. I did it in Python:

Here's the outcome:
Smoked 1 on day 0, with a total of 1
Smoked 8 on day -1, with a total of 9
Smoked 15 on day -2, with a total of 24
Smoked 22 on day -3, with a total of 46
Smoked 29 on day -4, with a total of 75
Smoked 36 on day -5, with a total of 111
Smoked 43 on day -6, with a total of 154
Smoked 50 on day -7, with a total of 204
The last day exceeds 200 a little but the solution towards the end of the book confirms that my figure is correct, stating that "he also had four cigarettes left over from his last packet".

Unrewarded Labor

A man persuaded Weary Willie, with some difficulty, to try to work on a job for thirty dollars at eight dollars a day, on the condition that he would forfeit ten dollars a day for every day that he idled. [1967 US dollars. Ed.] At the end of the month neither owed the other anything, which entirely convinced Willie of the folly of labor. Can you tell just how many days' work he put in and on how many days he idled?
(Source: 536 Curious Problems & Puzzles by Henry Ernest Dudeney, edited by Martin Gardner)

There were two unstated assumptions: it's a 30-day month and fractions of a day's labor or slacking are possible. Anyway this one is pretty easy: solve for $x$ where $x$ is the amount of days he worked during the month:

\begin{align*}8x - 10(30 - x) &= 0 \\
8x - 300 + 10x &= 0 \\
18x &= 300
\end{align*}

Final answer: Willie worked 16⅔ days and idled 13⅓ days during the month.

The Results of Repeated Doubling

A striking example of an exceedingly fast build-up of some small quantity when repeatedly doubled is the famous legend about the award to be given to the discoverer of chess.* Here is [another] example, less famous. [I'm doing the first part only. Ed.]

The infusorian paramecium divides in half on the average every 27 hours. If all newly born infusorians remained alive, how long would it take for the progeny of one paramecium to fill up a volume equal to that of the Sun?

Starting data: the 40th generation of a paramecium, when none perish, occupies one cubic metre; we take the volume of the Sun as equal to 1027 metres.

* See my book Figures for Fun, Mir Publishers, Moscow.

(Source: Algebra Can Be Fun by Yakov Perelman)

The author solved it a bit different but here's what I did. I started with the equation:

\[ 2^x = 10^{27} \]

Where $x$ is the required number of doubling periods, starting from the initial cubic meter volume. I then used logarithms to obtain $x$:

\begin{align*}
\ln(2^x) &= \ln(10^{27}) \\
x \ln(2) &= 27 \ln(10) \\
0.69 x &\approx 62.1 \\
x &\approx 90
\end{align*}
So the required number of doubling periods is almost exactly 90. I added 40 to $x$ to take into consideration the initial growth to cubic meter size then multiplied by $\frac{27}{24}$ to get days and I got a result just a little short of the author's of 146.25 days.