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 ...

No comments:

Post a Comment