There is a previous problem called the Envelope Paradox with a detailed explanation and solution given here. In short, the problem involves two envelopes with random (on some probability distribution $P$) amounts inside. You draw one and have to guess whether it contains more or less than the other. General intuition dictates you have at most a 50% chance of being right. However, by generating a random number on the same distribution, you may increase your chances to 66%.
My question is: What is the upper bound on the maximum accuracy when generating an infinite amount of random numbers when there are 3 envelopes?
Furthemore, a much harder one may be: what would the upper bound be for $k$ envlopes?
My investigation just for k=2 gave me the following
I've noticed that, by generating more numbers, $n$, you increase your chances of being right. Specifically, for $k = 2$ as $n\rightarrow\infty$ the probability you are correct approaches a maximum of $75\%$. We can see this graphically: MATLAB Simulation with 100,000 Monte Carlo Trials for each $n$
Or, we may just compute it. The number of arrangements of random numbers are equal to ${n+k\choose n}$. In the case of $k=2$, there simply are $\frac{(n+2)(n+1)}{2}$ arrangements. Making a guess based on these arrangements are dependent on where the majority of the numbers lie; let each number be $y_i \;\forall i = 1,2,\ldots,n$. For simplicity, lets work with just odd $n$'s. It is fairly intutive that the accuracy for $n+1$ is greater than $n$, while computationally, it can be seen that $\left(\Pr(n+1)-\Pr(n)\right)\approx0$ for large $n$'s. So we may assume that, for a large $n$'s, analyzing just odd $n$'s is enough.
When less than half the random numbers ($floor(n/2)$) are below those in the two envelopes $(a,b)$, there are an easily countable number of events where our prediction will have $100\%$ accuracy. We may then see that there exist $$\sum_{j=0}^{floor(n/2)}{n-ceil(n/2)+1\choose n-ceil(n/2)} = \left(floor(n/2)+1)\right)(n-ceil(n/2)+1) = x$$ of these situations. As shown in the previous link, all other events will only lead you to a correct guess $50\%$ of the time; you can work this out yourself just for odd $n$'s. Thus, the probability of you being correct having generated some odd $n$ random numbers is:
$$\left((100\%)x + (50\%)({n+2\choose n}-x)\right)/{n+2\choose n}$$
$$ = 1/2 + \frac{x}{(n+1)(n+2)}$$
When looking at just odd $n$'s,
$$ 1/2 + \frac{\left(\frac{n-1}{2}\right)\left(n-\frac{n+1}{2}+1\right)}{(n+1)(n+2)}$$
$$\lim_{n\to\infty} \left[ 1/2 + \frac{\left(\frac{n-1}{2}\right)\left(n-\frac{n+1}{2}+1\right)}{(n+1)(n+2)} \right] = 1/2 + 1/4 = 75\%$$
Running 1,000,000 Monte Carlo trials where $n=10000$ gave me $0.7446$, which is pretty close. The same for $k=3$ gave me $0.5143$, but how do we get there mathematically?