Hmm. I can Lagrange-multipliers it down to "Maximise
ai subject to a>0, i a natural number,
ai=16", anyway, because Lagrange multipliers on
abc subject to
a+b+c=16 yields
a=b=c. Then the only problem is to find how many terms are in the sum.
That is, maximise
(i16)i for integer i. Let's move to the more general
x as our sum (so x=16 above). Now, if i>x then we start raising something less than 1 to a high power, so that can't be a maximum. Our answer must therefore be less than x. Using i=1 gives us x straight off.
Suppose we'd found i. What would we know? We'd have that
ixi>i+1xi+1, or
i1i>i+11i+1x, or that
x<ii+1i(i+1). That fraction term tends to
e from below as i increases; in particular, we need
i+1>ex, or
i>ex−1. That suggests using i = roundup(x/e - 1).
How tight is this bound? Not sure. It is conceivable that the "fraction term tends to…" line makes the bound slacker than it needs to be.