»  Solutions to puzzles in my National Review Online Diary

  July 2008


The Math Corner in this month's diary included three brainteasers. Here they are with my solutions.


[1] Calendar blocks.   Imagine you have to represent the numbers for a date (01 to 31) using 2 cubes that each have a digit on each face. You can place the cubes in any order. What numbers should be on the faces of each cube?

Solution    If you can show 03, you can show 30, by switching blocks around. Removing these redundancies (i.e. ignoring the order of the blocks) we have to represent nine dates containing a zero (01, 02, …, 09) nine containing no zero but a one (11, 12, …, 19), and eight containing no zero or one but a two (22, 23, …, 29). Since a cube has only six faces, both cubes will have to have a zero, a one, and a two. That account for six of the twelve available faces — which is ugly, because we still have seven digits, 3 to 9, to display! We can fudge the issue by using a font in which an upside-down 6 is a 9. Since it doesn't matter which of the six digits 3, 4, 5, 6, 7, 8 goes where, put the 3 on the fourth face of one cube, then on the fifth face select one of the remaining five digits, then on the sixth face select one of the remaining four. The three left-over digits go on the other cube. Since 5 × 4 = 20, there are twenty ways to do this.

[2] Calendar blocks with leading-zero suppression.   Same question but with leading-zero suppression. That is, the sixth of the month is no longer represented by one face showing a 0 and the other showing a 6, but by one face showing a blank and the other a 6.

Solution    Same logic as before, but things are knottier because of that blank face. You have to represent nine dates containing a blank (denoted here by "b":  b1, b2, …, b9. Then nine containing a one: 10, 11, …, 19. Then eight containing a two: 20, 22, …, 29. Then 30, which is not accounted for elsewhere. So now both cubes need to have a blank face, a one face, and a two face; and somehow you have to get the remaining eight digits (0, 3, 4, 5, 6, 7, 8, 9) on to the other six faces! Being careful to have 0 and 3 on different faces! The 6-9 trick gets you down to seven digits for the six faces. To trim further is a stretch. I recommend a wee tick on the horizontal bar of the 7, so that when upside down it looks like a 4.
[These first two can be generalized indefinitely. Suppose you favor the three-digit day-within-year calendar (sometimes called "Julian" for reasons I don't understand, since there are already two perfectly good calendars called "Julian," one used by astronomers, the other by some of the Orthodox Churches). Now you need three blocks, with dates from 001 (or blank-blank-1) to 366 … etc.]
[Those three blocks in your "Julian" day-display must be drawn from some larger block stock. You now have 154 (I think) displays to generate, ranging from 001 to 366, and ignoring redundancies as before (e.g. 127, 172, 217, and 271 are the "same" display, the blocks only in a different order). Just three blocks won't do it. Clearly every one of the three would need to have a 1, a 2, and a 3, so that you can make the dates 111, 222, and 333. A little more thought shows that all three blocks would also need a 0. There are then just two faces left on each of the three blocks … Given that you need a stock of more than three blocks, what is the minimum number you need? Er …]

[3] Three dots.   You are traveling in a deep, dark forest when, suddenly, on a dark and stormy night, you are captured by the kind-but-not-so-bright forest people. They keep looking at you and saying to each other, "It be a smart person!" You are marched to their village and seated in the square. Before you are blindfolded, you notice two other lucky souls seated in chairs facing you. Then you are told that the forest people king is about to die. He previously sent messengers throughout the land seeking the 3 smartest people. You are one, and two others have also been found. He now gives you all a task to see which one is the smartest. He tells you, "I have seated you in an equilateral triangle so that each of you faces the other two. While you are blindfolded I will paint a dot on each of your foreheads. Each dot will be red or green so that there can be any combination of red and green dots, for example, 1 red and 2 greens, or all red, etc. When I remove the blindfolds each of you must raise your hand if you see any green dots, i.e. 1 or 2 dots. As soon as you have figured out what color your own dot is, tell me how you knew." Before any dots are painted, or blindfolds removed, the wisest person, (that's you!) says, "Your highness, you are going to paint a green dot on my forehead. The reason I know this is that …" Well, what is it?

Solution    The reason is, that only three green dots provides a fair test of who is smartest. One red dot is unfair to the guy having it, because he has no way to deduce the color of his dot. (The other guys' hands go up, and so does his. Seeing this, and his red dot, the other guys both declare themselves green, before the red-dot guy can exercise his smarts.) Two red dots just gives everyone the answer right away. (Each of the red-dot guys, seeing one red dot and one green with his hand down, knows at once that he's red; and the green-dot guy, seeing two reds with their hands up, knows he's green.) Three red dots: everyone sees two red dots and no hands up, and they all know they're all red.

With zero red dots, though (i.e. three green dots), smarts kick in. Seeing two green dots, both with their hands up, I might have either a red dot or a green dot (see above). The others reason similarly. Nobody can be sure. [Pause for thought.] But … neither of the other two declared himself green. They must be in the same quandary I'm in … therefore I'm green! Everyone has this same thing to figure out, so whichever figures it out first, is the smartest.

Since the three green dots scenario is the only fair and equal test of smarts, that's the one the king will use. Therefore he is going to paint a green dot on my head.

[4] Broken stick.   A perfectly straight and very thin rod is marked at random at two points, then divided into three parts at those points. What is the probability that you can form a triangle from the three parts?

[That last one is actually heavy-duty pure math — it was a Cambridge Tripos question in 1854. The answer is a commonplace number, though, and you can find it by some simple experimental math. MS Excel has a random-number generator you can use, the rand( ) function.]
Solution    It is the probability that three random numbers x, y, and z (i.e. the lengths of the fragments), all between zero and one, simultaneously satisfy:

        x + y + z = 1

        x + y − z > 0

        x − y + z > 0

        −x + y + z > 0

Where you take it from there depends on how much high school math you remember. Seeing x, y, and z, I go right to three-dimensional Cartesian co-ordinates & construct a unit cube with corners at (0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), (1,0,1), (1,1,0), and (1,1,1). All the triplets satisfying x + y + z = 1 are on a diagonal plane that slices off a corner of this cube; and the values between zero and one, as specified, lie on or in an equilateral triangle on this plane, vertices at (0,0,1), (0,1,0), and (1,0,0). Some subset of this equilateral triangle satisfies the three inequalities. If you work out the intersections of the planes x + y − z = 0 etc. with our equilateral triangle, they just go from midpoint to midpoint of its sides, cutting it up into a figure of one equilateral triangle made up of four smaller, identical ones. The region satisfying the inequalities is the innermost small one, a quarter of the big triangle's total area. Answer:  0.25, or one in four.

(Some readers grumbled that this wasn't "heavy-duty pure math." Trust me, as an old math teacher: to by far the larger portion of humanity, three-dimensional Cartesian co-ordinates are heavy-duty pure math!)

Some other readers had the temerity to diagree with my solution. Pah! All right, let's do experimental math. I'm not very deft with MS Excel, but here is a wee Visual Basic program to run ten million trials:

Option Explicit
Option Base 1

Sub Main()

      Dim lP, lTrue As Long
      Dim fA, fB, fX, fY, fZ As Single

      lTrue = 0

      For lP = 1 To 10000000
            fA = Rnd(1)
            fB = Rnd(1)
            If fA > fB Then
                  fX = fB
                  fY = fA - fB
                  fZ = 1 - fA
                  fX = fA
                  fY = fB - fA
                  fZ = 1 - fB
            End If
            If fX + fY > fZ And fY + fZ > fX And fZ + fX > fY Then
                  lTrue = lTrue + 1
            End If
      Next lP

      MsgBox (lTrue & " triangles in " & " trials.")

End Sub
That delivered 2,500,048 triangles in 10,000,000 trials. Happy now?


If you don't like my three-dimensional solution, here is a two-dimensional one.

Let s and t denote the locations of the two marks. In other words, (st) is uniformly distributed in the square [0,1]×[0,1].

The three pieces fail to form a triangle if the longest one is longer than ½.

There are three regions in the square where this happens:

            Region 1:   s < ½  and  t < ½   (the right piece is too long)
            Region 2:   s > ½  and  t > ½   (the left piece is too long)
            Region 3:   the absolute value of s − t  > ½   (the middle piece is too long)

If you block out these regions in the unit square, you are left with a butterfly-shaped region in the middle of area obviously ¼.