Sunday, July 16, 2023

Order of Operations

You are writing an expression using the whole numbers $1, 2, 3, 4, 5, \dots, 4N + 1,$ for some nonnegative integer $N$ and the operations of addition, subtraction, multiplication, and division. Importantly, you must use each number exactly once and each operation exactly $N$ times. Also, you can use as many parentheses as you would like. No concatenation of the digits is allowed (i.e., you can’t combine $2$ and $3$ to make the number $23$). What is the largest value you can generate, using the nine digits and eight operations?

The largest number generated using integers numbers $1, \dots, 4N+1$ and the four operations provided that each operation is used $N$ times is $$m(N) = (4N+1) (6N+1)^N.$$

To prove this we will need to argue first that $m(N)$ is equivalent to the number $\hat{m}(N),$ which is the largest number that can be constructed using only $N$ multiplications and $N$ additions using the number $2N+1, 2N+2, \dots, 4N, 4N+1.$ Certainly, any arithmetic expression using only $N$ multiplications and $N$ additions and the numbers $2N+1, \dots, 4N+1$ each once, say $x = f(2N+1, \dots, 4N+1),$ can be made into an aritchmetic expression using each of the integers $1, \dots, 4N+1$ once and each operation exactly $N$ times, by simply letting $$x = g(1, \dots, 4N+1) = \frac{f(2N+1, \dots, 4N+1)}{ (2N - (2N-1)) \cdot \cdots \cdot (2 - 1) }.$$ Therefore, we must have $m(N) \geq \hat{m}(N).$ We can reasonably hand-wave that it cannot be the case that $m(N) \gt \hat{m}(N),$ since that would imply that the largest possible outcome either consists of dividing by some non-unit divisor or subtracting some integer from a larger arithmetic expression. Both of which yield contradictions.

OK, so we have reasonably almost halved the problem and can now focus on only a problem of $N$ multiplications, $N$ additions and the integers $2N+1, \dots, 4N+1.$ Similar to the hand-wavey arguments above, it is straightforward that $\hat{m}(N)$ has the form $$x_1 \cdot (x_2 + x_3) \cdot \cdots \cdot (x_{2N} + x_{2N+1})$$ for some choice of $x = (x_1, \dots, x_{2N+1}) \in \mathfrak{X}$ where $$\mathfrak{X} := \{ (x_1, \dots, x_{2N+1}) \in \{2N+1, \dots, 4N+1\}^{(2N+1)} \mid x_i \ne x_j, \forall i \ne j \}.$$ With all of that hand-waving done, the only thing that is left to do is decipher the appropriate, maximal assignment of the variables $x = (x_1, \dots, x_{2N+1}) \in \mathfrak{X}.$

The AM-GM inequality states the arithmetic mean of nonnegative numbers is always greater than or equal to the geometric mean of those same numbers, that is, for any positive integer $k$ and any real numbers $y_1, \dots, y_k \geq 0,$ $$\frac{y_1 + \cdots + y_k}{k} \geq \sqrt[k]{y_1 \cdot \cdots \cdot y_k}.$$ So with the help of said AM-GM inequality, for any choice of variable assignments $x = (x_1, \dots, x_{2N+1}) \in \mathfrak{X},$ \begin{align*} x_1 \cdot (x_2 + x_3) \cdot \cdots \cdot (x_{2N} + x_{2N+1}) &= x_1 \prod_{i=1}^N (x_{2i} + x_{2i+1})\\ &\leq x_1 \left( \frac{ \sum_{i=1}^N (x_{2i} + x_{2i+1}) }{ N } \right)^{N} \\ &= x_1 \left( \frac{ \sum_{i=2}^{2N+1} x_i }{N} \right)^N\\ &= x_1 \left( \frac{(2N+1)(3N+1) - x_1}{N} \right)^N,\end{align*} where the last equality comes from the fact that $\sum_{i=2N+1}^{4N+1} i = (2N+1)(3N+1).$ Since the derivative of the right-hand side of the inequality is positive whenever $x_1 \lt \frac{(2N+1)(3N+1)}{N},$ and $\frac{(2N+1)(3N+1)}{N} \gt 4N+1$ for all nonnegative integers $N,$ if we want to maximize the right-hand side of the inequality for the choice of $x_1 \in \{2N+1, \dots, 4N+1\},$ we obtain the upper bound for \begin{align*}\hat{m}(N) &\leq (4N+1) \left( \frac{(2N+1)(3N+1) - (4N+1)}{N} \right)^N\\ &= (4N+1) \left( \frac{6N^2 + 5N + 1 - (4N+1)}{N} \right)^N\\ &= (4N+1) (6N+1)^N.\end{align*} On the flip side, this upper bound is actually achieved by $\hat{x} \in \mathfrak{X}$ such that \begin{align*} \hat{x}_1 &=4N+1, \\ \hat{x}_2 &= 2N+1,\\ \hat{x}_3 &= 4N, \\ \hat{x}_4 &= 2N+2, \\ \hat{x}_5 &= 4N-1,\\ &\dots, \\ \hat{x}_{2i} &= 2N+i,\\ \hat{x}_{2i+1} &= 4N-i+1,\\ &\dots, \\ \hat{x}_{2N} &= 3N, \\ \hat{x}_{2N+1} &= 3N+1\end{align*} so we have "proven" (via some hand waving) that $$m(N) = \hat{m}(N) = (4N+1) (6N+1)^N.$$ In particular, the first few values of $m(N)$ are given by 35, 1,521, 89,167, 6,640,625, and 601,212,171 for $N= 1, 2, 3, 4,$ and $5,$ respectively. I smell a new OEIS entry coming on ...

Monday, July 10, 2023

New Riddle Service .... Who Dis?

N.B.Given the new iteration of the Riddler, there are those who might surmise that I would change the name of my Riddler answer blog from on of the aliases of the Batman villain to some fiddling pun, like, I'm just spitballing here, I dunno... Stradi's Various Answers Shop, but I am lazy, so Ed Nigma lives on!

Suppose I start with a strip of paper that’s 10 inches long and 1 inch wide. I twist it once and attach the two 1-inch edges together, forming a Möbius strip. Finally, I draw a dot somewhere in the center of the strip—that is, the dot is half an inch away from both edges.

Naturally, the distance between any two points on my strip is the shortest path between them, as the ant crawls. By that, I mean that such paths can go over an edge to the other “side” of the strip (“side” in quotes because it’s all really the same side, after all), just as an ant would crawl around the edge of the paper. There is a unique point on the strip that is the farthest distance from my dot. What is this distance?

We can represent the strip of paper as a $10" \times 1"$ rectangle that has two (2) $10" \times 0.5"$ rectangles stacked immediately above and immediately below it. The two smaller rectangles represent the ``other side'' of the strip. Since this is a M\"{o}bius strip, the orientation of the left and right sides of the rectangles are reversed, so for instance lower left and upper right corners of the 10" \times 1" rectangle are the same point and same with the upper left and lower right. Meanwhile, the upper edge of the upper smaller rectangle and lower edge of the lower smaller rectangle are the same. Additionally, the midpoint of left side of the $10" \times 1"$ rectangle is simultaneous the upper right corner of the upper smaller rectangle and the lower right corner of the lower smaller rectangle, and vice versa with the midpoint of the right side of the larger rectangle. That was confusing enough, so let's set up a frame of reference and see if we can measure something, eh?

Assume the larger rectangle is given by $\{ (x,y) \mid 0 \leq x \leq 10, |y| \leq 0.5 \},$ with the upper and lower smaller rectangles given by $\{ (x,y) \mid 0 \leq x \leq 10, 0.5 \leq \pm y \leq 1 \},$ respectively. Finally, without loss of generality, assume that your mark is made at the origin. Then since the points $(0,0)$, $(10,1)$ and $(10,-1)$ are synonymous, the ``as the ant crawls'' metric is given by $$d(x,y) = \min \{ \sqrt{x^2+y^2}, \sqrt{ (x-10)^2 + (y-1)^2 }, \sqrt{ (x-10)^2 + (y+1)^2 } \}.$$ Maximizing this metric over the set $\{ (x,y) \mid 0 \leq x \leq 10, |y| \leq 1 \}$ gives the maximum possible distance away of $$d^* = \max_{ 0\leq x \leq 10, |y| \leq 1 } d(x,y) = 5.05,$$ which is obtained at the point $(x^*, y^*) = (5.05, 0)$ which is synonymous with the points $(4.95, \pm 1).$