If $a_{1}, ..., a_{m}$ positive integers and $ \sum_{i=1}^{m} a_{i} = 1976$, find $\max( a_{1} a_{2} ... a_{m} )$.
Attempt:
Notice by AM-GM: $$ \frac{\sum_{i=1}^{m} a_{i} = 1976}{m} \ge (a_{1} a_{2} ... a_{m})^{1/m} $$
So if $m$ is held fixed, then $a_{1}a_{2}...a_{m}$ is maximized if $a_{1} = ... = a_{m}$ (when possible that $1976$ is divisible by $m$).
Using "algorithmic" approach, start with largest possible $m=1976$ and move backwards:
Let $F(m)$ be $\max(a_{1}...a_{m})$ and we find $F$ for each case $m$.
$m=1976$ then $$F = 1 \cdot 1 \cdot 1 \cdot ... \cdot 1$$
$m=1975$ then we remove one $a_{i}$ from the $m=1976$ case, choose the smallest one to get $$ F = 2 \cdot 1 \cdot 1 \cdot ... \cdot 1$$
$m=1974$ then we remove the smallest value from the previous case above, and then distribute it to the other $1974$ numbers. Add to $2$? or add two $1$? pay attention to $a_{i}=2$ and $a_{j}=1$, if we add 1 to either one of them, the total will always be $4$, so by AM-GM $a_{i}a_{j}$ is maximized when both are equal. So we add $1$ to the $a_{j}=1$.
$$ F = 2 \cdot 2 \cdot 1 \cdot ... \cdot 1 = 4$$
continuing this, one see that $F$ increasing as $m$ decrease until $m=988$ we get
$$ F(988) = 2^{988}$$
next, if $m=987$:
we must remove one $2$ from the case $m=988$ and distribute it to the other $987$ numbers. $2$ can be distributed to at most two $a_{i}$s, so the sum of two numbers. So by AM-GM $F$ is maximized when the two $a_{i}$s are equal, so we must have
$$F(987) = 3^{2} 2^{985} $$
and we see $F(987) > F(988)$ because $3^{2} > 2^{3}$. Continuing this, $F(987) < F(986) < ... < F(659)$ because of same reason $3^{2} > 2^{3}$. We have
$$F(659) = 3^{658} 2 $$
But after this, we can see $F(658)$ is less than $F(659)$. How to prove (or disprove) that $3^{658} 2$ is the maximum?
2nd attempt:
$F(658) = 4^{2} 3^{656}$ this is less than $F(659)$. Then let us view the 1st five terms in
$$(4 + 4 + 3 + 3 + 3) + ... $$
if we distribute a $3$ into the 5 numbers, no matter how we do it we will have the sum equal $20$, and the multiplication of the 5 numbers is maximized when all are equal, so
$$ F(657) = 4^{5} 3^{652} $$ and this is less than $F(658)$ because $3^{4} > 4^{3}$. Continuing until $m = 494$ $$F(494) = 4^{494}$$
and $F(657) > F(656) > ... > F(494)$ because $3^{4} > 4^{3}$.
So far we still have $F(659)$ as the largest.