Consider the following problem:
Find
distinct positive integers that add up to and have the maximum product.
— Singapore Mathematical Olympiad, 2005
If the integers are non-distinct, the
For
with equality if and only if
Intuitively, the integers should be as close to each other as possible for the maximum product if they have the same sum.
For a pair of integers, this can be proven by the quadratic equation:
So
Which makes the minimum difference between
Alternatively, it might be easier to visualize by considering the odd and even cases separately.
Sum is odd:
Sum is even:
So for
We can manually check each possible permutation:
Hmm, is there a better way than manually checking every possible permutation?
Can we solve the generalized problem:
Find
distinct positive integers that add up to and have the maximum product.
If we were to manually check each permutation, we would have to check
Lemma: There can be at most
Let the
Suppose there are
Consider the pair
The current difference is
Keeping the sum the same at
The new difference is
Since the new difference is smaller, the new product
With the new changes,
Hence, the sequence cannot have
We can enumerate all such unique sequences, and show that the sum is strictly increasing by
If there exists a pair of consecutive integers that has a difference of
Else, we can add
If
If
Surprisingly, we can use the solution to solve the much more general problem:
Find
distinct positive integers that add up to and have the maximum product.
Similarly,
If
If
Massive thanks to Joel Yip for helping with the problem and solution!