# The largest integer made of 1,2,3,4

What is the largest integer $A$ that can be produced from the four digits $1,2,3,4$ subject to the following rules?

• Each of the digits $1,2,3,4$ is used exactly once.
• Juxtaposition of digits is allowed (so one may for instance juxtapose 1 and 3 to get "31")
• The allowed mathematical operations are addition (+), multiplication (*) and exponentiation (^).
• You may use brackets "(" and ")" to structure your expression, and to make it well-defined (for instance, this allows you to distinguish a^(b^c) from (a^b)^c).
• Tetration, factorial etc. are not allowed; Prime(n) would be fun too.
– smci
Commented Mar 20, 2015 at 9:11
• Since the competitors are all double-exponentials, it helps to graph on log-log or log1p-log1p axes.
– smci
Commented Mar 20, 2015 at 9:26
• Was trying to explore divisions by zero but it seems all possible avenues were blocked. Good question :P Commented Mar 22, 2015 at 16:46
• Cool puzzle, thanks. Commented Jan 12 at 12:04

I have been searching the internet for this one and found a link to the page "1, 2, 3, 4 - four digits that DWARFED the universe". On the bottom of this page there is a table with a few of the great combinations that can be made with $$1$$, $$2$$, $$3$$, and $$4$$. If you look for the entries with just the numbers (no decimals, no minus, etc.), you see the following:

• $$2^{3^{41}}$$ has got $$10^{19}$$ digits
• $$3^{4^{21}}$$ has got $$10^{12}$$ digits
• $$3^{421}$$ has got $$201$$ digits
• $$4^{321}$$ has got $$194$$ digits
• $$2^{431}$$ has got $$130$$ digits

You can calculate/test numbers yourself with this gigantic online calculator: HyperCalc Javascript

(Trying to give an explanation): As @h34 notes in a comment: We need to use exponentiation to get the biggest number. If you draw a graph of an exponential function it shoots upward after a few numbers. For instance the simple binary function $$2^x$$ results in: $$2, 4, 8, 16, 32, 64, 128, 256, \ldots$$ (we all know this sequence). More precisely:

• Any expression of the type $$x + 1$$ or $$x \cdot 1$$ or $$x^1$$ or $$1^x$$ can be given a bigger value by juxtaposing the digit $$1$$ to some other digit in the expression $$x$$. Therefore the digit $$1$$ will not stand alone in the expression, but will be juxtaposed to some other digit. Furthermore, the digit $$1$$ will come after the other digit(s) in this juxtaposition.
• For $$x, y \ge 2$$, we always have $$x^y \ge x+y$$ and $$x^y \ge x \cdot y$$. Therefore, the maximizing expression will only use exponentiations.
• Any expression $$x$$ without exponentiation will have value at most $$4321$$.
• Any expression $$x^y$$ with only a single exponentiation will have value at most $$3^{421}$$ (which is about $$7.38×10^{200}$$).
• Therefore it remains to consider expressions of the form $$a^{b^{c}}$$ where one of $$a,b,c$$ is $$21$$, $$31$$, or $$41$$, and where the other two are single-digit numbers.
• If $$a$$ consists of two digits then the value of $$a^{b^c}$$ is at most $$41^{3^2}$$, which is much smaller than $$2^{3^{41}}$$. Therefore $$a$$ is a single digit. If $$b$$ has two digits and $$c\ge2$$ is single digit, then $$b^c. Therefore $$b$$ is single digit and $$c$$ has two digits.

Hence, it only remains to analyze the six possible candidates $$2^{3^{41}}$$, $$2^{4^{31}}$$, $$3^{2^{41}}$$, $$3^{4^{21}}$$, $$4^{2^{31}}$$, and $$4^{3^{21}}$$.

• For the fifth candidate, we have $$4^{2^{31}} = 2^{2 \cdot 2^{31}} = 2^{2^{32}},$$ whereas for the sixth candidate, we have $$4^{3^{21}} = 2^{2 \cdot 3^{21}} < 2^{3^{22}}.$$ Hence both candidates are clearly smaller than the first candidate $$2^{3^{41}}$$.

• For the fourth candidate, we have $$3^{4^{21}} = 3^{2^{2 \cdot 21}} = 3^{2^{42}},$$ which dominates and eliminates the third candidate $$3^{2^{41}}$$.

• The fourth candidate is $$3^{4^{21}} < 4^{4^{21}} = 2^{2^{43}}.$$ The last exponent $$2^{43}$$ satisfies $$2^{43} = 2^6 \cdot 2^{37} < 81 \cdot 3^{37} = 3^{41},$$ and hence is smaller than the exponent of the first candidate. This eliminates the fourth candidate.

• Finally, let us compare the exponents of the first and the second candidate: $$4^{31} = 2^{11} \cdot 2^{51} = 2048 \cdot 8^{17} < 2187 \cdot 9^{17} = 3^7 \cdot 3^{34} = 3^{41}.$$ This eliminates the second candidate.

Summarizing: The answer is that the first candidate $$2^{3^{41}}$$ yields the largest possible value.

Spoiler

If we want to get the answer as big as we possibly can, we need to use the highest numbers as many times as possible within the calculation. To achieve this we use exponentiation multiple times with the numbers in increasing order: $$1^{2^{3^4}}$$. The $$1$$ doesn't do anything in this calculation, so we put it together with the highest number $$4$$ to create an even bigger number: $$2^{3^{41}}$$

Another Spoiler

And to answer the question, why not $$3^{2^{41}}$$? Here is a graph of both $$2^x \cdot \log(3)$$ and $$3^x \cdot \log(2)$$. These functions give the best view about the differences between them.

Indeed, $$3^{2^x}$$ has a head start (begins at $$3$$ rather than $$2$$), but it quickly passed by the $$2^{3^x}$$-function when $$x > 1.14$$ and never crosses again.

• log(g) = 2^x log(3) ; log(f) = 3^x log(2) . Hence comparing their log-ratio log(f)/log(g) = (3/2)^x log(2)/log(3) ≈ (1.5)^(x -1.135883). Probably better to graph them on log-y or log-log-y axes or log1p-log1p
– smci
Commented Mar 20, 2015 at 9:22
• Considering that $3^{2^{x}} = (2^{log_2 3})^{2^{x}} = 2^{2^{x}\cdot{log_2 3}}$, it is easy to see that $2^{3^{x}}$ will grow much faster.
– Tgr
Commented Mar 21, 2015 at 4:14
• @Gamow Thank you for editing and completing my answer. Explaining and educating us all about the math behind this all +1 Commented Mar 24, 2015 at 9:56

I would say the answer is:

$2^{3^{41}} \approx 10^{10^{19}}$

However, I cannot prove it.

• This is correct. Handwaving proof follows. We need all operations to be exponentiation; we need to put the numbers in increasing order; the best thing to do with the 1 is to put it on the end of the highest number. QED :-). Similarly for {1,2,3,4,5} the answer would be $2^{3^{4^{51}}}$.
– h34
Commented Mar 19, 2015 at 12:10
• Well, so much for handwaving. My conclusion for {1,2,3,4,5} was incorrect. $3^{4^{5^{21}}}$ is much greater than $2^{3^{4^{51}}}$ (source: playing with the facility here).
– h34
Commented Mar 19, 2015 at 15:19
• @h43 incorrect, your original handwaving proof is still waving. Remember to read the output of HyperCalc Javascript correctly. $3^{4^{5^{21}}}$ gives as output: $10^{2.371373705661655 × 10^{287084575332623}}$ and $2^{3^{4^{51}}}$ gives as output: $10^{10^{2.4192921797081044 × 10^{30}}}$ The confusion is understandable, but if you put $3^{4^{5^{21}}}-2^{3^{4^{51}}}$ in the tool HyperCalc Javascript, you get a negative number. Which means the 2nd number ($2^{3^{4^{51}}}$) is bigger. Commented Mar 20, 2015 at 11:17

The largest number that can be produced here is indeed $2^{3^{41}}$. But going for the general case, we need to identify what will give us the highest number. The most important thing is to get the largest number we have as high up in the power tower as possible. And the same goes for the next largest number. The last thing we have to remember is if we have the number $1$, the best thing we can do with it is to put it at the end of the highest number of the power tower, effectively multiplying that number by 10. So if we have $\{1,\,2,\,3,\,4,\,5\}$ we want to put $5$ as high as possible, and then $4$ the next highest. We end up with $2^{3^{4^{51}}}$. If we have $\{2,\,3,\,4,\,5,\,6\}$ we would get $2^{3^{4^{5^6}}}$.

3^(2^41) which is a very large number .

• It indeed seems a huge number, but why not 4^(3^21) or 2^(3^41)? Commented Mar 19, 2015 at 11:35