Monday, January 26, 2026

Baby Bingo

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?

To do this, let's define some terms. Let's denote the squares, as follows: the top row moving left to right is $a, b, c$, then the left box on the middle row is $d$ and the right box on the middle row is $e$, and finally the bottom row from left to right is $f, g, h.$ Let $N$ be the random number of markers needed until getting bingo on this 3-by-3 grid. Since it is a random variable on the natural numbers, we can use the sum of tail probabilities to obtain the expected value, that is, $\mathbb{E}[N] = \sum_{n=0}^\infty \mathbb{P} \{ N \gt n \}.$

We see that since you need three in a row, the smallest number of markers you will need to get bingo with the help of the free center square is $2$. So we have $\mathbb{P} \{ N \gt 0 \} = \mathbb{P} \{ N \gt 1 \} = 1.$ Additionally, we see that there are only four configurations where $N=2,$ namely, $\{a,h\}$, $\{b,g\}$, $\{c,f\}$ and $\{d,e\}$. Since these can be selected in any order, we actually have $2! \cdot 4 = 8$ possible winning combinations out of a total possible of $8 \cdot 7 = 56$ combinations of $2$ squares, so $\mathbb{P} \{ N = 2 \} = \frac{8}{56} = \frac{1}{7},$ so therefore, $\mathbb{P} \{ N \gt 2 \} = \frac{6}{7}.$ Similarly, we see that there are 11 winning combinations with $N \leq 3,$ namely $\{a,b,c\},$ $\{a,b,g\},$ $\{a, b, h\}$, $\{a, c, f\},$ $\{a, c, h\}$, $\{a, d, e\},$ $\{a, d, f\},$ $\{a, d, h\}$, $\{a, e, h\},$ $\{a, f, h\},$ $\{a, g, h\},$ $\{b, c, f\},$ $\{b, c, g\},$ $\{b, d, e\},$ $\{b, d, g\},$ $\{b, e, g\},$ $\{b, f, g\},$ $\{b, g, h\},$ $\{c, d, e\},$ $\{c, d, f\},$ $\{c, e, f\},$ $\{c, e, h\},$ $\{c, f, g\},$ $\{c, f, h\},$ $\{d, e, f\},$ $\{d, e, g\},$ $\{d, e, h\},$ and $\{f, g, h\}.$ If we wanted to make sure that $N = 3,$ then we would need to make sure we know the right order to ensure that for instance we don't have $d$ then $e$ then $a$, which would win after $N=2.$ However, let's just focus on $N \leq 3$, where we don't care, so we have $3! \cdot 28 = 168$ possible winning combinations with $N \leq 3$ out of $8 \cdot 7 \cdot 6 = 336$ possible combinations of 3 squares. So we have $\mathbb{P} \{ N \leq 3 \} = \frac{168}{336} = \frac{1}{2},$ which leaves $\mathbb{P} \{ N \gt 3 \} = \frac{1}{2}.$

We are making good progress. One item to note is that we also have $\mathbb{P}\{ N \leq 5 \} = 1$ or conversely $\mathbb{P} \{ N \gt n \} = 0$ for all $n \geq 5.$ We can see this by appealing to a slightly modified pigeonhole principle. We see that there are 8 total sets of three, but since these sets contain overlapping squares, we will assume that whenever a square is selected a marker is added to each set that contains that square. From the pigeonhole principle, if we have 17 total markers, then at least one set must be complete. We start off with 4 markers from the free center square. We also note that the corner squares are each in three sets, while the middle squares are in two apiece. If we have 5 squares to play with and want to try not to have a set, then we could have at most one of the squares from the middle column and at most one of the squares from the middle row, which would mean that we have 3 corner squares (for a total of 9 markers) and 2 middle squares (for a total of 4 markers). Together with the free central square we see that 5 squares gives at least 9 + 4 + 4 = 17 markers, so we are guaranteed to have a full set with $N=5.$

So the only thing remaining is to determine $\mathbb{P} \{ N \gt 4 \}.$ We see that there are 8 configurations of four squares that do not yet win, namely $\{a, b, e, f\},$ $\{a, c, d, g\},$ $\{a, c, e, g \},$ $\{a, e, f, g \},$ $\{b, c, d, h \},$ $\{b, d, f, h\}$ $\{b, e, f, h\},$ and $\{c, d, g, h\}.$ Since the order of these non-winning configurations does not matter, we have a total of $4! \cdot 8 = 192$ not yet winning combinations out of a total of $8 \cdot 7 \cdot 6 \cdot 5 = 1680$ four square combinations, so we see that $\mathbb{P} \{ N \gt 4 \} = \frac{96}{1680} = \frac{4}{35}.$

Therefore putting everything together we get that the expected number of markers you must place until you get bingo on a 3-by-3 grid is $$\mathbb{E}[N] = \sum_{n=0}^\infty \mathbb{P} \{ N \gt n \} = 1 + 1 + \frac{6}{7} + \frac{1}{2} + \frac{4}{35} = \frac{243}{70} = 3.4\overline{714285}.$$

Sunday, January 18, 2026

Who listens to their architect anyway?

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?

Let's imagine that this restaurant is named, say Cafe Pythagoras. Abstracting the Classic problem's solution by having a circle of radius $r$ centered at $(0,h),$ then we have the minimal distance from the lamp to the reflected path of the light from the ground to the ceiling as $d^* = 2h \sin \theta.$ Therefore, we see that $$R = \min \{ 3h \tan \theta \mid 2h \sin \theta \geq r \} = 3h \tan \left( \sin^{-1} \left(\frac{r}{2h} \right) \right) = \frac{3hr}{\sqrt{4h^2 - r^2}}.$$

Since the architect at Cafe Pythagoras wants to make sure that $r$, $h$ and $R$ are all integers, we should start searching through Pythagorean triples for possible solutions, since if the denominator $\sqrt{4h^2 -r^2}$ is not an integer, then there is no way for $R$ to be an integer. In particular we need $2h$ to be the hypotenuse of a Pythagorean triple and either $r=2a$ or $r=2b$. Naturally, let's start with the triple $(3,4,5)$. So we set $h=5$ and try $r=6,$ which yields the undesirable $R = \frac{45}{4} \not\in \mathbb{N}.$ If instead, $h=5$ and $r=8$, then we get $R = 20,$ so at least we know that this your architect is not asking for the impossible. By taking scaled multiples, say $h=5k$, $r=8k$ and $R=20k,$ for any $k \in \mathbb{N},$ we see that in fact the architect can have infinitely many solutions, with the smallest one generated by the (3,4,5) primitive Pythagorean triple having a shadow radius of $R=20$.

Let's assume that we have some integers $a, b, c \in \mathbb{N}$ with $a^2 + b^2 = c^2,$ $\gcd (a,b,c) = 1,$ and $c \gt 5$ and see if we can come up with any other solutions for our Pythagorean architect. Without loss of generality, let's see what would happen if we set $h = c$ and $r = 2b.$ In this case we get $$R = \frac{6bc}{\sqrt{4h^2 - (2b)^2}} = \frac{6bc}{2a} = \frac{3bc}{a}.$$ Since $\gcd(a,b,c) = 1,$ if $a \ne 3,$ then $R \not\in \mathbb{N}.$ Since the only primitive Pythagorean theorem that contains $3$ is $(3,4,5),$ we see that if $(a,b,c) \ne (3,4,5),$ then $R \not\in\mathbb{N}.$

Therefore, we have confirmed two very important things: Firstly, that the smallest possible value of $R$ at Cafe Pythagoras is $R=20,$ when $h=5$ and $r=8.$ And, lastly, but perhaps equally important, I don't think that I'll be going to Cafe Pythagoras. With a sizeable 8' radius orb floating with its center only 5' off the ground, that means that the orb would be larger than the actual ceiling height???!!! The beam of light does escape the ginormous lamp and properly reflect off the floor and up to the ceiling after 20' as promised, but something seems off about the architectural demands. Perhaps I'm just too old to be the target audience for this restaurant. I hear the food is good though!

Shadows on the ceiling

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?

Let's assume that the lightbulb is at the point $(0,5)$ and let's track the path of a ray of light that is emitted making an of $\theta$ with the $y$-axis as shown in the figure below. We see that it will bounce of the reflective floor at the point $(5\tan \theta, 0)$ and then return towards the ceiling with an angle of reflection of $\theta$ to make contact with the ceiling at the point $(15 \tan \theta, 10).$ The line from the bulb to the floor is given by $y = \left(-\cot \theta\right) x + 5,$ whereas the reflected line from the floor to the ceiling is given by $y= \left(\cot \theta\right) x - 5.$

To find the point along the reflected path from the floor to the ceiling we can either solve the optimization problem $$d^* = \min \{ (5+10\lambda)^2 \tan^2 \theta + (10 \lambda - 5)^2 \mid 0 \leq \lambda \leq 1 \}$$ either by some raw calculus or we can use the Lagrange multiplier theory and the knowledge that the line from the lightbulb to the point that minimizes the distance from the lightbulb should be perpendicular to the path of the light and some geometry. Going the geometric path, we see that since the hypotenuse of the right triangle has length $5 \sec \theta$ and the opposite angle measures $2\theta,$ so we have a distance of $$d^* = 5 \sec \theta \sin 2\theta = 10 \sec \theta \sin \theta \cos \theta = 10 \sin \theta.$$

Since the entire lamp, whether the opaque top or the semi-transparent lower half, would prevent the light from reaching the ceiling, we need to make sure that this minimal distance is at least 1, that is whenever $10 \sin \theta \geq 1$ then the ceiling will be illuminated. Therefore, the radius of the circular shadow is $$R = \min \{ 15 \tan \theta \mid 10 \sin \theta \geq 1 \} = 15 \tan \left( \sin^{-1} \frac{1}{10} \right) = \frac{15}{\sqrt{99}} = \frac{5}{\sqrt{11}} \approx 1.50755672289\dots,$$ since $\tan \left(\sin^{-1} x\right) = \frac{x}{\sqrt{1-x^2}}.$

Monday, January 12, 2026

Doesn’t matter eventually it’s the same

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, 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?

Let $C_k(x)$ be the ounces of coffee in the coffee cup after $k$ successive iterations of moving $x$ ounces back and forth for some $x\in (0, 12],$ since there's literally no action when $x=0.$ Here we have $C_0(x)=12$ for any value if $x \in (0,12].$ Since after each iteration we have the total volume in the coffee cup as 12, and extrapolating from the worked in the Classic problem where $x=1$, we will always have that the amount of tea in the coffee cup is equal to the amount of coffee in the tea cup, so we see that the amount of coffee in the tea cup at the end of $k$ successive iterations is $12-C_k(x).$

When $x$ ounces is transferred from the coffee cup to the tea cup, a total of $x\frac{C_k(x)}{12}$ ounces of coffee is trabsferred to the tea cup. At this point there is a total of $12-C_k(x) + x\frac{C_k(x)}{12}$ ounces of coffee in the tea cup, out of a total of $12+x$ ounces of liquid. After mixing, when the $x$ ounces of liquid is transferred back to the coffee cup, a total of $x\frac{12-(1-x/12)C_k(x)}{12+x}$ ounces of coffee is transferred. Using this information, we can get the recursive formula $$C_{k+1} (x) = C_k(x) - \frac{x}{12}C_k(x) + \frac{x}{x+12} \left( 12 - \left(1-\frac{x}{12}\right) C_k(x) \right) = \frac{12-x}{12+x} C_k(x) + \frac{12x}{12+x}.$$

In general a linear sequence $a_{n+1}=ra_n+b$, for $n\in \mathbb{N},$ will converge to some number $a^*=\frac{b}{1-r}$, whenever $|r|\lt 1.$ Here we have r=r(x)=\frac{12-x}{12+x} \in [0,1) for x \in (0,12], so we should converge for any value of $x$ to $$C^*=C^*(x) = \frac{\frac{12x}{12+x}}{1-\frac{12-x}{12+x}} = \frac{\frac{12x}{12+x}}{\frac{2x}{12+x}}=6.$$

In addition, we can rearrange the recursive formula to show that $C_{k+1}(x)$ is always a convex combination of $C_k(x)$ and $6,$ so in particular we see that $C_k(x)$ is a nonincreasing sequence for each $x \in (0,12].$ So we must have that the minimal amount of coffee in the coffee cup after many, many iterations is $\inf_k C_k(x) = C^* = 6$ ounces. Now for the strict constructivists amongst you, we need not appeal to countably infinitely many mixings or ignore infinitissimal quantities obtain optimality. Instead, if we chose $x=12$ ounces, then after a single iteration, voila, we have the perfect 6 oz coffee / 6 oz tea concoction.

Is it coftea? Teafee?

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?

In this Classic case, after transferring 1 ounce of coffee to the tea cup, it would have 1 ounce of coffee and 12 ounces of tea. Once thoroughly mixed, each ounce of the liquid would have $1/13$ ounce of coffee and $12/13$ ounce of tea in it. So after moving one ounce back to the coffe cup, the coffee cup would have $11+1/13=144/13$ ounces of coffee and $12/13$ ounces of tea. Conversely, the tea cup would have $1-1/13=12/13$ ounces of coffee and $12-12/13=144/13$ ounces of tea. So after one mixing back and forth the volume of tea in the coffee cup is equal to the volume of coffee in the tea cup.

Monday, December 22, 2025

No $N\times N$ Prime Magic for 2026

Find all values of $N$ for which it is possible to construct an $N$-by-$N$ prime magic square with a magic number of 2026.

The generic update for the magic number formula that we used in the Classic problem states that as long as $j>1$ and $j \mid N^2$, then we can construct an $N\times N$ magic square with magic number $$M_N = M_N(a,j,r,s) = Na + \frac{N}{2} \left( (j-1) r + \left( \frac{N^2}{j} -1\right) s \right),$$ using any natural magic square using numbers $i=1, 2, \dots, N^2$ and mapping $i \leftarrow a_i,$ where $$a_i = a + \left((i-1)\!\!\!\!\! \mod j\right) r+ \Big\lfloor \frac{i-1}{j} \Big\rfloor s, \,\, i=1,\dots, N^2.$$

One thing that we see is that the smallest magic number of for $N\times N$ magic squares occurs for a natural magic square, that is where $a=r=s=1$ and $j=N^2$, and is $$m(N) = \min M_N=\frac{N(N^2+1)}{2}.$$ Since we have $m(16)= 2056 \gt 2026$ we know that we need only search for up to $N\leq 15.$ That said, just as we did for the Classic problem we will lean on some basic number theory.

Firstly, since $2026$ is not a prime, we cannot trivially solve using a $1 \times 1$ magic square that simply contains the number $2026.$ Additionally, there are no $2 \times 2$ magic squares at all, let along prime ones, so we must look for value of $2 \lt N \leq 15$ where there are

Furthermore, we see that besides the $1\times 1$ magic square that only contains $2,$ that any non-trivial prime magic square cannot contain $2,$ and that furthermore both of the differences in the arithmetic progression system, $r$ and $s,$ must be even to hop from one odd prime to another. Therefore, we see that there again exists some $p, q \in \mathbb{Z}$ such that $r=2p$ and $s=2q$ such that \begin{align*}M_N = M_N(a,j,r,s) &= Na + \frac{N}{2} \left( (j-1)r + \left(\frac{N^2}{j} - 1 \right)s \right) \\ &= N \left( a + (j-1) p + \left( \frac{N^2}{j} - 1\right) q \right) \in N\mathbb{Z}.\end{align*} However, since $2026 = 2 \cdot 1013$ and $1013$ is prime, we see that there cannot be any $2 \lt N \leq 15$ such that $N \mid 2026$ and therefore, there are no prime magic squares with a magic number of 2026, for any integer $N.$

This was a lot of null results this week, but lest you think that it is impossible for all numbers, if we close our eyes for a year, then 2027, which is prime will be a trivial $1\times 1$ prime magic square. Additionally, in the not so distant past, we see that 2019 was primally magic with the following $3 \times 3$ magic square:

229 1327 463
907 673 439
883 19 1117

No $4\times 4$ Prime Magic for 2026

A magic square is a square array of distinct natural numbers, where each row, each column, and both long diagonals sum to the same “magic number.” A prime magic square is a magic square consisting of only prime numbers. Is it possible to construct a 4-by-4 prime magic square with a magic number of 2026? If so, give an example; if not, why not?

Well first thing's first. We see from the prompt and from Dürer's engraving that 4-by-4 magic squares do exist. In fact, OEIS A006052 shows that there are 880 distinct natural 4-by-4 magic squares, which contain the numbers $1, 2, \dots, 16,$ that is which a magic number of $$M=\frac{1}{4} \sum_{i=1}^{16} i = 34.$$ The question is whether or not one exists with added constriants of including only prime numbers and having a magic number of $M=2026.$

First we notice that the numbers $1$ through $16$ form an arithmetic progression. With not so much checking (see the figure below), we see that if $$a_i = a + r(i-1), \,\,i= 1,\dots, 16,$$ for some $a, r \in \mathbb{Z},$ that if we replace each integer $i$ in Dü rer's magic square with $a_i$, that we again retrieve a magic square but this time with magic number $$M=M(a,r)=\frac{1}{4} \sum_{i=1}^{16}\left(a+ r(i-1)\right)= 4a+30r.$$ What's more is that we can actually have a system of arithmetic progressions, namely for any $j\gt 1$ with $j \mid 16,$ we can define $$a_i = \begin{cases} a+(i-1)r, & i=1, \dots, j\\ a+(i-j-1)r + s, & i=j+1, \dots, 2j\\ \dots & \\ a + (i+j-17)r + (16/j-1)s, & i=17-j, \dots, 16.\end{cases}$$ We see in the figures below the cases for $j=2$ and $j=16$ (which was the case covered earlier. In this case the generic magic number formula is \begin{align*}M=M(a,j,r,s)&=\frac{1}{4} \sum_{i=1} a_i \\ &= 4a + 2(j-1)r + 2\left( \frac{16}{j} - 1 \right) s.\end{align*}

4-by-4 Magic square with j=16
a+15r a+2r a+r a+12r
a+4r a+9r a+10r a+7r
a+8r a+5r a+6r a+11r
a+3r a+14r a+13r a


4-by-4 Magic square with j=2
a+r+7s a+s a+r a+6s
a+2s a+r+4s a+5s a+r+3s
a+4s a+r+2s a+3s a+r+5s
a+r+s a+7s a+r+6s a

Ok now with all the arts and crafts out of the way lets use the formula for $M=M(a,j,r,s)$ to see if we can end up with any prime magic squares with $M=2026.$ Since we wnat to have a prime square we must have $a$ prime and $a \ne 2.$ Similarly, since we will have a bunch of odd primes in our arithmetic progressions we will need to have the differences $r, s \in 2\mathbb{Z}.$ However, we then quickly see that no matter what value of $j \in \{2, 4, 8, 16\},$ if $r, s \in 2\mathbb{Z},$ then there are $p, q \in \mathbb{Z}$ such that $r=2p$ and $s=2q,$ so we have \begin{align*} M=M(a,j,r,s) &= 4a+2(j-1)r + 2\left(\frac{16}{j}-1\right) s \\ &= 4\left( a + (j-1) p + \left(\frac{16}{j}-1\right) q \right) \in 4\mathbb{Z}.\end{align*} Since $2026 \not\in 4\mathbb{Z}$, there are no prime 4-by-4 magic squares with magic number $M=2026.$