Sunday, May 21, 2017

Regex Crossword

I'm going to phone this one in, sort of, because it's an entire site of puzzles. Regex Crossword is a twist on the traditional crossword concept. In each cell you have to enter in a character that satisfies two or more regular expressions that apply to the cell in question. They start out really trivial but start to get very difficult later on. This is the last one I solved and holy shit was it ever tough:

I'm hooked. Go check these out.

Thursday, May 18, 2017

The Merchants and the Coin Purse

Three merchants saw in the road a purse [containing money].
One said, "If I secure this purse, I shall become twice as rich as both of you together."
Then the second said, "I shall become three times as rich."
Then the third said, "I shall become five times as rich."
What is the value of the money in the purse, as also the money on hand [with each of the three merchants]?
(Source: The Penguin Book of Curious and Interesting Puzzles by David Wells, this puzzle by way of the Bakhshali manuscript)

Let $p$ be the value of the contents of the purse and $m_1$, $m_2$ and $m_3$ be the values of the cash on hand held by the first, second and third merchants, respectively. If you read the problem right, this problem becomes a system of linear equations:

\begin{align*}
p + m_1 &= 2(m_2 + m_3) \\
p + m_2 &= 3(m_1 + m_3) \\
p + m_3 &= 5(m_2 + m_3)
\end{align*}

You may notice that there are four unknowns and only three equations, making the system underdetermined. (But that's just as well given that my knowledge of medieval Indian currency is effectively nonexistent.) That being said, to the extent that it can be solved—I did so in Maxima—the answer is $p = 3$, $m_1 = \frac{r_1}{5}$, $m_2 = \frac{3 r_1}{5}$, $m_3 = r_1$, where $r_1$ is effectively an arbitrary constant. But if we hone in on the solution that has the smallest values possible without allowing fractional coins, then the merchants, in order, hold one, three and five coins of equal value, respectively, and the purse contains 15 coins of that value. This means, for example, that by securing the purse, the first merchant would then hold 16 coins, twice as many as three held by the second and the five held by the third added together.

Extracting the Cherry

This puzzle is a golden oldie, with a simple but elusive answer.

The cocktail cherry is inside the glass, which is formed from four matches. Your task is to move at most two of the matches, so that the cherry is then outside the glass. You can turn the glass sideways or upside down if you wish, but the shape must remain the same.

Move two matches to extract the cherry.
(Source: Professor Stewart's Cabinet of Mathematical Curiosities by Ian Stewart)

The solution I came up with was to shift the horizontal match far enough to the right that its non-flammable end touches that of the lower vertical match and then take the left vertical match at the top and set it perpendicular to the flammable end of the horizontal match, so that it forms a new "side" of the glass. (Of course this process can also by started by shifting the horizontal match to the left and the answer will be symmetrical to the one obtained doing things how I did them.)

If that description was confusing—I wouldn't blame you for finding it thus—here's how it's portrayed in the solutions: