What is the ratio between the base and exponent that results in the largest number? For instance, out of all integer solutions, if the base and exponent add up to 10, the number $4^{6}$ is the largest. If they added up to 20, $7^{13}$ is the largest. If they added up to 100, $24^{76}$ is the largest.
Furthermore, what if the base and exponent were weighted in how much they counted towards this value? Before, I assumed that the base and exponent had weights of 1:1. But if the base weighed half as much as the exponent, and they added up to 10, out of all integer solutions, $4^3$ is the largest. If they added up to 20, $6^7$ would be the largest. if they added up to 100, $24^{38}$ would be the largest.
Is there an equation for finding the ratio between the base and exponent that yields the greatest number, given the "sum" of the base and exponent, as well as how much they weigh with respect to each other?
 A: There is, but it's not pretty. 
To capture the constraint of the the exponent and base adding to a specific number, we can rewrite the problem slightly, as finding the value of $x$ which maximizes the value of $f(x)=x^{N-x}$ for a given value of the sum, $N$. 
To find a maximum of what's essentially a single-variable function (because N is fixed) like this, we can solve for the value of $x$ where $\frac{df}{dx}=0$. (Depending on your background, you may want to read about derivatives,  stationary points and how to find them) 
This is unfortunately where it gets messy, because $\frac{df}{dx}=-x^{-1 + n - x} (-n + x + x \log(x))$. 
That $x^{...x}$ at the beginning implies that the solution involves something rather arcane called the Lambart W function, and indeed Wolfram Alpha solves $\frac{df}{dx}=0$ for $x$ to produce $x=e^{W_0(eN)-1}$. (The 0 in $W_0$ is important in this context because the function has multiple outputs in general, and we want a particular one) 
This formula almost always doesn't produce an integer answer, so you'd then have to round. As an example and sanity check, when $N=10$, then $x=4.13...$, and when $N=20$, $x=6.84...$, which agrees with the OP.
