The list of positive whole numbers that add up to 1 is simply (1), and you might think of the product of this list as being 1.
There are several lists of positive whole numbers that add up to 2, and the lists (1,1) and (2) have different products if you multiply the list elements: 1 and 2. The lists of positive whole numbers that add up to 3 yield products 1, 2 and 3, corresponding to the lists (1,1,1), (1,2) and (3). If n represents a positive whole number, what is the largest product that can be formed by multiplying the elements of a list of positive whole numbers that sum to n?
Understanding the Problem
Understanding the problem is simple. Given an integer n, what is the largest product of integers that sum to n. We are given the fact that for any integer n, n sums to n and n is the product by itself. So given the integer 3, the possibilites are :(1,1,1)
(1,2)
(3)
So the largest product here would be '3'.
Devising a Plan
I will try to find a connection or some sort of a pattern given an integer n to find the value of its largest products of sums.Carry out a Plan
A couple of things I notice. For n<=3, the greatest product will be n itself. For the numbers up to 10, I wrote up a comprehensive list of all the products of sums, avoiding any sum with a '1' as that does not contribute any growth to the product. So for 1 the product is 1, for...
- 2 - 2
- 3 - 3
- 4 - 2 * 2
- 5 - 3 * 2
- 6 - 3 * 3
- 7 - 3 * 2 * 2
- 8 - 3 * 3 * 2
- 3 - 3
I notice that the pattern arises with powers of 2 and 3, as those are the smallest prime number divisors. The reason we choose powers of 2 and 3 is because we know that exponential function grow more rapidly than any power functions.
Looking Back
I came up with the following solution.When:n%3 = 0, We will have n/3 '3's.
n%3 = 2, We will have (n-2)/3 '3's and 1 '2'
n%3 = 1, We will have (n-4)/3 '3's and 2 '2's
I knew that 3*n grows more rapidly than 2*n for all n, so I set up my solution in a way to have as many terms with 3 as possible and fill up the remaining sum with terms of 2 for which any more '3's would contribute a remainer.