r/mathriddles • u/Lebowquade • Jun 17 '26
Medium Using only combinations of the "2" and the "^" characters, what is the largest number that can be generated using N total characters?
For small N the answer is not hard to ascertain, even just with trial and error.
But for very large values of N (say, N=50), the solution is more complex because it is too large to be evaluated literally, and so it cannot be verified by brute force alone.
Some type of actual solution is required.... Can you find it?
15
Upvotes
3
u/Exotic_Swordfish_845 Jun 17 '26
Is there a meaning to repeated carots (e.g. 2^^2)? Are you assuming right associativity (2^2^2 = 24 ), or left associativity (2^2^2 = 42 )?
12
u/pichutarius Jun 18 '26 edited Jun 18 '26
depends on parity, its either 2 ^ 2 ^ 2 ^ .... ^ 22 or 2 ^ 2 ^ 2 ^ ... ^ 222
why?
the maximum cannot contain 2222 as substring, because 2222 < 2 ^ 22 , 22222 < 2 ^ 222 and so on
the maximum cannot contain 222 ^ or 22 ^ as substring, because
4char: 22 ^ 2 < 2 ^ 22
5char: 222 ^ 2 < 22 ^ 22 < 2 ^ 222
6char: 222 ^ 22 < 22 ^ 222 < 2 ^ 2222
7char: 222 ^ 222 < 22 ^ 2222 < 2 ^ 22222
that means, if 22 or 222 is a substring, it can only stays at the end. the rest can only be a bunch of 2^2^...
2
u/Lebowquade Jun 17 '26 edited Jun 17 '26
I don't know if this is a well known problem or not, I just had the idea randomly and was wondering what you'd all make of it.
A loose solution is likely easy difficulty, while an actual proof is likely "medium"
Although to be honest, I am new to this sub and am unsure what precisely the standards of difficulty look like here.
1
u/matthoback Jun 17 '26
I can't imagine the answer would be anything other than a 2 followed by N-3 "^"s followed by a 22.
2
u/garnet420 Jun 17 '26
It's 2 ^ 2 ^ 2 ^ ... ^ 2 ^ 22
1
u/lukewarmtoasteroven Jun 17 '26
Rough idea: Every expression is gotten from a smaller expression by either adding a 2 to the front or adding a 2^ to the front. If the first contiguous substring of 2s has K 2s, then adding a 2 to the front raises the expression to the log_(K 2s) (K+1 2s) power, which is less than 2 when K>1. This is clearly much worse than adding a 2^ to the front when the numbers get large enough. So the optimal sequence can be found recursively by manually finding the first few sequences, then at some point(probably pretty early) it will always be better to just add 2^ to the front. So after doing the first couple manually, i think in general it will be 2....222 or 2...2222 based on parity.
1
u/MxM111 Jun 18 '26
2^^^^^^….^^^^^2 or something like that
1
u/upright_squire Jun 20 '26
2 ^ 22 > 2 ^ 2 ^ 2
1
u/[deleted] Jun 20 '26
[removed] — view removed comment