“Leonard Nimoy, who played the most famous TV scientist of all time, Mr. Spock, came from an arts and theater background and in real life is nothing like his character. Yet he told me that because Mr. Spock and “Star Trek” have inspired so many young viewers to become scientists, researchers who meet him are always desperate to give him lab tours and explain the projects they’re pursuing in peer-to-peer terms. Mr. Nimoy nods sagely and intones to each one, “Well, it certainly looks like you’re headed in the right direction.””
This week the #puzzle is: How Long Is the All-Star Streak? #math #probabilities #InfiniteSums #coding #MonteCarlo
The Fiddler Basketball Association’s All-Star Game consists of two teams: “East” and “West.” Every year these two teams play a game, each with a 50 percent chance of winning that’s independent of the outcomes of previous years.
Many, many years into the future, you look at the most recent results of the All-Star Game. On average, what is the longest current winning streak that one of the teams is on? (Here, having won only the most recent game still counts as a “streak” of one game.)
And for extra credit:
To spice up the All-Star Game, the commissioner of the FBA has decided that there will now be three teams competing in All-Star Games: “Stars,” “Stripes,” and “International.” Each year, two of the three teams play each other. If one year has Stars vs. Stripes, the next year has Stripes vs. International, the year after that has International vs. Stars, and then the cycle repeats with Stars vs. Stripes.
Many, many years after this new format has been adopted, you look at the most recent results of the All-Star game. On average, what is the longest current winning streak that one of the teams is on? (As before, having won one game counts as a “streak.” Also, note that the team with the longest winning streak might not be one of the two teams that played in the most recent All-Star Game.)
This week the #puzzle is: Can You Hop in a Spiral? #geometry #trigonometry #angle #arctan #minimize #markovchain #coding
Frankie the frog is hopping on a large, packed grid of lily pads, shown below. The pads are circular and each is a distance 1 from its nearest neighbors. (More concretely: Each pad has a diameter of 1 and they are arranged in a hexagonal lattice.) Frankie starts at (0, 0), the center of the pad labeled A. Then she hops due east to pad B at (1, 0), and from there she hops to pad C at (1.5, √(3)/2).
She wants to continue hopping in a counterclockwise, spiral-like pattern. Each of her jumps is to the center of a neighboring pad, a net distance of 1. But there are two rules her spiral must follow:
– Each next pad must be in a more counterclockwise direction (relative to spiral’s origin at pad A) than the previous pad. – Each pad must be farther from A than the previous pad.
After a number of hops spiraling around, Frankie realizes she is, once again, due east from A. What is the closest to A she could possibly be? That is, what is the minimum possible distance between the center of the pad she’s currently on from the center of pad A?
And for extra credit:
Frankie has stored all of her food on lily pad A. However, her food has a tendency to “fly” away. Every second, the food that’s on every lily pad splits up into six equal portions that instantaneously relocate to the six neighboring pads.
At zero seconds, all the food is on lily pad A. After one second, there’s no food on pad A, and 1/6 of the food is on each of the surrounding six pads. After two seconds, 1/6 of the food is again on pad A, while the rest of the food is elsewhere.
After how many seconds N (with N > 2) will pad A have less than 1 percent of its original amount?
I try to construct the path in Desmos. At every step, is it possible to turn 60° counter clockwise and still obey the rules? If not, continue straight ahead.
There are just too many steps!
Method 2:
I write a program to assist. I look at all 6 directions. But I also know which 2 are 60° counter clockwise and straight ahead. I look at the distance and the angle. And then I choose.
I reuse Desmos to show the result.
I end up at a distance 64.
Method 3:
I can vaguely see a method, where I keep going straight ahead, until I reach x = 0, y = x/2k or y = – x/2k. (k = √3/2.) (These guide lines are also shown in Desmos.) Let’s try it out. Desmos 2 assists.
I want my spiral to be as tight as possible. From any point, I test going back the same way, or 60° less, or 120° less, or 180° less, or 240° less, or 300° less, in that order. I am looking for small additions to the distance to A, hopefully getting large jumps in angle.
|AX| denotes the distance between points A and X, where points A and X are the centers of pads A and X. αX denotes the angle to point A from X.
Looking for D.
From C = (1.5,k) I could go back to D0 = B. But |AD0| = |AB| < |AC|, as the rules state. Likewise αD0 = αB < αC, as the rules state. Rejected.
I could go to D1. But |AD1| < |AC|. Rejected.
I could go to D2. |AC| = 1.73, |AD2| = 2. αC = 30°, αD2 = 60°.
I could go to D3. |AD3| = 2.65. αD3 = 40.89°. D2 would be better, more angle, less distance.
I could go to D4. αD4 = 19.11°. Rejected.
I could go to D5. αD5 = 0°. Rejected.
I choose D = D2 = (1,2k). |AD| = 2. αD = 60°.
The line through C and D crosses y = x/2k in C. It is y = -2kx + 4k.
Looking for E.
E1 = D1. |AE1| = |AD1| < |AC| < |AD|. Rejected.
E2. |AE2| < |AD|. Rejected.
E3. |AE3| = 2.65. αE3 = 79.11°.
E4. αE4 = 60°. Not smaller than αD. Rejected.
E5 = D3. αE5 = 40.89°. Rejected.
There’s only 1 choice, E3 = E = (0.5,3k). |AE| = 2.65. αE = 79.11°.
Looking for F. F1 fails both distance and angle. F2 has the same distance. F3 is okay. F4 and F5 both fail the angle rule. So I choose F3 = F = (0,4k). I am now on the line x = 0 and the line y = 4k.
Going forward, I will choose G3, H3 etc. until I reach L3, on the line y = – x/2k. All these points are on the line y = 4k. Then I will turn left a little, choosing M2. And then go straight forward a bit.
Let’s look at some of these distances a bit more detailed.
Being in D = (1,2k), on the line y = -2kx + 4k, I am looking for E.
|AD|2 = 12 + (2k)2
E1 = D + (-0.5,-k).
|AE1|2 = (1-0.5)2 + (2k-k)2 < 12 + (2k)2 = |AD|2
E2 = D + (-1,0).
|AE2|2 = (1-1)2 + (2k+0)2
= 12 – 2*1*1 + 12 + (2k)2
= 12 + (2k)2 – 2*1*1 + 12
= |AD|2 – 2*1*1 + 12
= |AD|2 – 2 + 1
= |AD|2 – 1
< |AD|2
E3 = D + (-0.5,k)
|AE3|2 = (1-0.5)2 + (2k+k)2
= 12 – 2*1*0.5 + 0.52 + (2k)2 + 2*2k*k + k2
= 12 + (2k)2 – 2*1*0.5 + 0.52 + 2*2k*k + k2
= |AD|2 – 2*1*0.5 + 0.52 + 2*2k*k + k2
= |AD|2 – 1 + 0.52 + 4k2 + k2
= |AD|2 – 0.75 + 5k2
= |AD|2 + 3
Distance wise, E3 is the only candidate. (E4 and E5 are rejected because of the angle.)
For a more general case, let’s look at the search for H, I etc.
X = (x, 4k), x < 0
Y1 = (x+0.5, 4k-k)
Y2 = (x-0.5, 4k-k)
Y3 = (x-1, 4k)
Y4 = (x-0.5, 4k+k)
Y5 = (x+0.5, 4k+k)
|AX|2 = x2 + (4k)2
|AY1|2 = (x+0.5)2 + (4k-k)2
= x2 + 2*0.5*x + 0.52 + (4k)2 – 2*4k*k + k2
= x2 + (4k)2 + 2*0.5*x + 0.52 – 2*4k*k + k2
= |AX|2 + 2*0.5*x + 0.52 – 2*4k*k + k2
= |AX|2 + x + 0.52 – 8k2 + k2
= |AX|2 + x + 0.52 – 7k2
We want |AX|2 < |AY1|2
<=> |AX|2 < |AX|2 + x + 0.52 – 7k2
<=> 0 < x + 0.52 – 7k2
<=> – 0.52 + 7k2 < x
<=> – 0.25 + 7*(√3/2)2 < x
<=> – 0.25 + 7 * 3/4 < x
<=> 5 < x
But x < 0, so that won’t happen.
|AY2|2 = (x-0.5)2 + (4k-k)2
= x2 – 2*0.5*x + 0.52 + (4k)2 – 2*4k*k + k2
= x2 + (4k)2 – 2*0.5*x + 0.52 – 2*4k*k + k2
= |AX|2 – 2*0.5*x + 0.52 – 2*4k*k + k2
= |AX|2 – x + 0.52 – 8k2 + k2
= |AX|2 – x + 0.52 – 7k2
We want |AX|2 < |AY2|2
<=> |AX|2 < |AX|2 – x + 0.52 – 7k2
<=> 0 < – x + 0.52 – 7k2
<=> x < 0.52 – 7k2
<=> x < 0.25 – 7*(√3/2)2
<=> x < 0.25 – 7 * 3/4
<=> x < -5
This should certainly happen at some point, say x = -6. In that case we would have M2 = (-6.5, 3k).
Let’s also look at Y3.
|AY3|2 = (x-1)2 + (4k)2
= x2 – 2x + 1 + (4k)2
= x2 + (4k)2 – 2x + 1
= |AX|2 – 2x + 1
We want |AX|2 < |AY3|2
<=> |AX|2 < |AX|2 – 2x + 1
<=> 0 < – 2x + 1
<=> 2x < 1
<=> x < 0.5
We already have that as x < 0.
The turn to M2 happens at L3 = (-6, 4k).
x = -6
k = √3/2
1/k = 2/√3
= 2√3/3
Does L3 lie on y = – x/2k?
y = – (-6) / (2k)
= 6/2k
= 6 * 2√3/3 / 2
= 6 * √3/3
= 2 * √3
= 4 * √3/2
= 4k
Yes, it does.
I think I need some more details here. But they should be trivial.
Sketch: Rotate the situation around A. L3 is now on x = 0. Do similar calculations. Etc.
In conclusion: Within the guide lines, travelling on a line perpendicular to x = 0, y = x/2k or y = – x/2k, it is safe to turn left when a guide line is hit.
This week the #puzzle is: Bingo! #statistics #probabilities #combinatorics #counting #coding #program #montecarlo
A game of bingo typically consists of a 5-by-5 grid with 25 total squares. Each square (except for the center square) contains a number. When a square’s number is called, you place a marker on that square. The goal is to get “bingo,” which is five squares in a row, either across, down, or along one of the two long diagonals. The center square, which doesn’t have a number, is labeled “Free,” and begins with a marker on it before any numbers are called. Here’s an example of a winning 5-by-5 grid in which 10 squares (other than the “Free” square) have been marked:
Consider a smaller version of the game with a 3-by-3 grid: a “Free” square surrounded by eight other squares with numbers. Suppose each of these eight squares is equally likely to be called, and without replacement (i.e., once a number is called, it doesn’t get called again).
On average, how many markers must you place until you get “bingo” in this 3-by-3 grid? (The “Free” square doesn’t count as one of the markers—it’s “free”.)
And for extra credit:
Instead of a 3-by-3 grid, let’s return to the original 5-by-5 grid.
On average, how many markers must you place until you get “bingo”? (As before, the “Free” square doesn’t count as one of the markers—it’s “free”.)
I had to optimize the program quite a lot to get a reasonable run time. Memoization. And taking into account, that each setup exists in 8 versions, rotated and mirrored. As always it’s a joy when a recursive function suddenly works.
This week the #puzzle is: Can You Brighten Up the Room? #geometry #trigonometry #angles #reflection #animation
While dining at a restaurant, I notice a lamp descending from the ceiling, as shown in the diagram below. The lamp consists of a point light source at the center of a spherical bulb with a radius of 1 foot. The top half of the sphere is opaque. The bottom half of the sphere is semi-transparent, allowing light out (and thus illuminating my table) but not back in. The light source itself is halfway up to the ceiling—5 feet off the ground and 5 feet from the ceiling. The ground reflects light.
Above the light, on the ceiling, I see a circular shadow. What is the radius R of this shadow?
And for extra credit:
Now suppose the lamp has a radius r and is suspended a height h off the ground in a room with height 2h. Again, the radius of the shadow on the ceiling is R.
For whatever reason, the restaurant’s architect insists that she wants r, h, and R, as measured in feet, to all be whole numbers. What is the smallest value of R for which this is possible?
This month the #puzzle is: Math puzzle: The homesick rover #addition #sum
Far away, on a large, rocky exoplanet, a rover from Earth has just arrived on a mission of exploration. But the poor thing doesn’t want to explore. The moment it begins moving, it grows homesick and wants nothing more than to return to the very spot where it began. Unfortunately, it has received very explicit instructions. The first day, it must travel one kilometer forward in a straight line, then turn 90 degrees. The second day, it must travel two kilometers forward, then turn 90 degrees. The third day, it must travel three kilometers forward, then turn 90 degrees. The fourth day, it must travel four kilometers forward, then turn 90 degrees. And so on, for the duration of an eight-day mission.
The rover wants to return to the site where it landed. But it can choose only which direction to turn, left or right, at the end of each day. How can the rover end the eight-day mission back at its landing site?
And as a bonus:
A hundred rovers with the same set of instructions have been sent to other large, rocky planets, each with a different mission length, ranging from one day to 100 days.
How many of these rovers can end their missions back at their landing sites?
The rover travels 1 km in some direction on day 1. Let’s call it north.
On day 2 it travels 2 km either east or west.
On day 3 it travels 3 km either north or south.
And so on for 8 days.
It must go the same amount north as south. It travels 1+3+5+7 = 16 in all. It must go 8 north and 8 south. This can be achieved by traveling e.g. 1+7 north and 3+5 south.
Same principle for east and west. 2+4+6+8 = 20. 2+8 = 4+6 = 10.
k = 4 works, the sum has 8 numbers, the 4 innermost and the 4 outermost have the same sum, 1+3+13+15 = 5+7+9+11 = 32. In general, this can be done when k is divisible by 4.
k = 5 works, 19+17+13+1 = 3+5+7+…+16 = 50.
k = 6 works, 23+21+19+9 = (the rest) = 72.
k = 7 works, 27+25+23+19+3+1 = 98
(so far I am just constructing a sum, to see whether it can be done)
k = 8 works, k = 2 * 4
Given the first 2k odd numbers, can I always find a sum of 2k2?
Let’s look at the sum of the m top odd numbers:
4k-1 + 4k-3 + … + 4k-2m+1
= m/2 * (4k-1 + 4k-2m+1)
= m/2 * (8k – 2m)
= m * (4k-m)
I create a spreadsheet and look at my options. If for each k I can find an m, so that the difference between 2k2 and m * (4k-m) is small enough to be filled with small, odd numbers, I am home.
Apparently the only k, this doesn’t work for, is 1.
For an n day mission, if there are 2k odd numbers (meaning n = 4k or n = 4k-1), and k is an integer, 1 < k, then we can get the sums of odd numbers to work.
This means 7, 8, 11 and 12 might work. And we have already checked, that regarding the odd numbers, they do.
Now let’s look at the even numbers.
e = 2+4+…+n, where n is even.
e = n/2 * (2+n)/2
= n * (2+n) / 4
= (n2 + 2n) / 4
This has to split up nicely into 2 sums of (n2 + 2n) / 8.
So n2 + 2n is divisible by 8.
We know n is even, so it could be written as 2k.
n2 + 2n = (2k)2 + 2*2k
= 4k2 + 4k
= 4k * (k + 1)
This is divisible by 8 when k is divisible by 2 or k is odd — so always!
n = 2. This still fails, because 2 is only 1 number and can’t be split up into 2 sums.
n = 4. This still fails, 2+4 can’t be split up.
n = 6. 2+4+6 = 2+4 + 6 = 2 * 6.
n = 8. Already done.
n = 10. 2+4+6+8+10 = 2 * 15? Oh wait. e/2 also has to be even, because it’s a sum of even numbers. So this fails.
e/2 = 4k * (k + 1)/8
= k * (k+1)/2
If 2 divides k:
k/2 * (k+1)
This is even when k/2 is even.
If 2 divides k+1:
k * (k+1)/2
This is even when (k+1)/2 is even.
New rule: Either k or k+1 is divisible by 4.
n = 10. k = 5. We need (5+1)/2 = 3 to be even, and it isn’t.
n = 12. k = 6. k is even, but k/2 = 3 isn’t. e = 42. e/2 = 21. Fail.
n = 14. k = 7. k+1 = 8 is divisible by 4. e = 56. e/2 = 28. 1 of the sums could be 14 + 12 + 2. Success.
n = 16. k = 8, divisible by 4. e = 72. e/2 = 36. 1 of the sums could be 16 + 14 + 6. Success.
n = 18, k = 9, k+1 = 10, neither divisible by 4. Fail.
n = 20, k = 10, k+1 = 11, neither divisible by 4. Fail.
n = 22, k = 11, k+1 = 12, divisible by 4. e = 132. e/2 = 66. 1 of the sums could be 22 + 20 + 18 + 6.
n = 24, k = 12, divisible by 4. e = 156. e/2 = 78. 1 of the sums could be 24 + 22 + 20 + 18.
At this point I predict: For an n day mission, if there are k = n/2 even numbers (meaning n = 2k or n = 2k + 1), if either k or k+1 is divisible by 4, then we can get the sums of even numbers to work.
Putting the 2 rules together:
For an n day mission, if there are 2k odd numbers (meaning n = 4k or n = 4k-1), and k is an integer, 1 < k, then we can get the sums of odd numbers to work.
At this point I predict: For an n day mission, if there are k = n/2 even numbers (meaning n = 2k or n = 2k + 1), if either k or k+1 is divisible by 4, then we can get the sums of even numbers to work.
Let’s write this another way.
The mission has n days.
If x is an integer, 1 < x, n = 4x or n = 4x-1, success for the odd numbers.
If y is an integer, n = 2y or n = 2y + 1, y or y+1 divisible by 4, success for the even numbers.
Example of the calculation of a ship’s mast from a cedar log.
If someone says to you: “[Make] a mast from a cedar log 30 cubits
long [such that the mast] is 1/3 1/5 (?) [of the length of the log].” Calculate 1/3 1/5 of this 30.
[If the result is 16, say to him:] “You have obtained
[this mast. You have found it] correctly.”
Nowadays we would have a formula:
ml = c * cl
ml: mast length
c: constant
cl: cedar length
And of course we would have drilled school children in this formula, because everybody needs to know these things. Next we would have defined, for this particular problem, some values:
c = 1/3 + 1/5
cl = 30 cubits
We’re not used to writing values with fractions like that in our time, so we need to convert that.
For some time now I have been trying to understand the Moscow Mathematical Papyrus. And for me, understanding = writing and sharing. Therefore the results of my thoughts are now available on this page.
What is this particular papyrus? Well, it’s math problems and solutions. Some of its importance hinges on “did they know how to do that already?” This goes for problems 10 and 14 especially. They knew how to calculate the area of a sphere? And the volume of a pyramid? Well, apparently, yes. They could also work with unknowns and take square roots. Exciting!
At some point the papyrus ended up in Moscow, and a lot of research was done on it at that time.
This week the #puzzle is: Some Coffee With Your Tea? #summation
I have two glasses, one containing precisely 12 fluid ounces of coffee, the other containing precisely 12 fluid ounces of tea.
I pour one fluid ounce from the coffee cup into the tea cup, and then thoroughly mix the contents. I then pour one fluid ounce from the (mostly) tea cup back into the coffee cup, and then thoroughly mix the contents.
Is there more coffee in the tea cup, or more tea in the coffee cup?
And for extra credit:
I have two glasses that can hold a maximum volume of 24 fluid ounces. Initially, one glass contains precisely 12 fluid ounces of coffee, while the other contains precisely 12 fluid ounces of tea.
Your goal is to dilute the amount of coffee in the “coffee cup” by performing the following steps:
– Pour some volume of tea into the coffee cup. – Thoroughly mix the contents. – Pour that same volume out of the coffee cup (i.e., into the sink), so that precisely 12 fluid ounces of liquid remain.
After doing this as many times as you like, in the end, you will have 12 ounces of liquid in the coffee cup, some of which is coffee and some of which is tea. In fluid ounces, what is the least amount of coffee you can have in this cup?
I’m not quite sure what happened with the magic squares. I guess the method I found (writing code to calculate equations and choose among primes) didn’t work. Ah well.
I was actually part of the way with the extra credit. N has to be even. N can’t be 18 or more. But then I would have gotten it wrong, by saying N = 4 wouldn’t work.
Highlight to reveal (possibly incorrect) solution:
Thoughts:
There’s 12 fluid ounces in each cup. There’s a coffee cup and a tea cup.
After the mixing, the coffee cup still has 12 fluid ounces, some of it coffee, some of it tea. Let’s say the amount of coffee is c and the amount of tea is t.
12 = c + t.
The tea cup has the amount 12 – c of coffee and 12 – t of tea. (The rest of the coffee and the rest of the tea.)
How much coffee in the tea cup?
12 – c
= (c + t) – c
= c + t – c
= t
There’s t tea in the coffee cup and t coffee in the tea cup. The 2 amounts/ratios are the same.
tc0 = f(0) (tea in coffee cup 1st time , for some function f)
Then something is poured out.
Δcc = cc0 * f(0) / (cc0 + tc0)
= cc0 * f(0) / (12 + f(0))
Δtc = tc0 * f(0) / (12 + f(0))
cc1 = cc0 – Δcc
= cc0 – cc0 * f(0) / (12 + f(0))
= cc0 (1 – f(0)/(12 + f(0))
tc1 = tc0 (1 – f(0) / (12 + f(0))
cc2 = cc1 (1 – f(1)/(12 + f(1))
cc0 (1 – f(0)/(12 + f(0)) (1 – f(1)/(12 + f(1))
Example 1:
f is always some ε, constant.
We go n = 12 / ε rounds.
ccn = cc0 (1 – ε/(12 + ε)n
= cc0 (1 – ε/(12 + ε)(12/ε)
Going to desmos, this expression has a minimum with ε approaching 0, approximately 4.41455. This looks suspiciously like 12/e. Also it’s the best option I’ve found.
Example 2:
f is shrinking. E.g., it might say, that each round half the remaining pure tea is added.