Let N={1,2,} be the set of positive integers. A partition of nN is a way of writing n as a sum of positive integers, called parts. For example, 1+2+3 is a partition of 6, with parts 1, 2, and 3. Partitions are unique up to rearrangement: 1+2+3 and 3+2+1 are the same partition, but 1+2+3 and 3+3 are different partitions.

This post discusses the following problem:

Let n2 be a positive integer. Find a partition of n whose parts have maximum product.

For example, the parts in 1+2+3 have product 1×2×3=6, while the parts in 3+3 have product 3×3=9. Our goal is to find a product-maximising partition for arbitrary n.

Let x1+x2++xk be a partition of n. If x1=1 then k2 (since n2) and i=1kxi=1×x2×i=3kxi<(1+x2)×i=3kxi because the xi are strictly positive.1 Thus, replacing the partition x1+x2++xk with (1+x2)+x3++xk delivers a greater product. Since the xi can be rearranged arbitrarily, it follows that product-maximising partitions contain no parts equal to one. Similarly, if x1>4 then i=1kxi=x1×i=2kxi<3(x13)×i=2kxi, so we can obtain a greater product by replacing x1+x2++xk with 3+(x13)+x2++xk. It follows that product-maximising partitions contain no parts greater than four. But 2×2=4 and 2+2=4, so we can replace each four with two twos without reducing the parts’ product. Thus, we can obtain a product-maximising partition using only twos and threes. Finally, if a partition contains three twos then we should replace them with two threes, since 2+2+2=3+3 but 23=8<9=32.

To summarise, we can obtain a product-maximising partition using only twos and threes, with as many threes as possible. Letting n=3q+r for some qN{0} and r{0,1,2}, the maximum product we can obtain is P(n)={3qif r=022×3q1if r=12×3qif r=2. We can approximate this solution by relaxing the integrality constraint on the xi. For any given k, we can find the vector x that solves (1)maxxR+ki=1kxi subject to i=1kxi=n, where R+ is the set of positive real numbers. This vector has xi=n/k for each i{1,2,,k}, so that i=1kxi=(n/k)k.2 If there was no integrality constraint on k then we could maximise (n/k)k by choosing k=n/e, where e2.718 is Euler’s constant. But k must be an integer, so we should round it to the nearest integer in whatever direction delivers the greatest value of (n/k)k. Doing so delivers an estimate P^(n)=max{(nn/e)n/e,(nn/e)n/e} of P(n), where xx and xx are the floor (“round down”) and ceiling (“round up”) functions.

The table below compares P(n) and P^(n) for various n. Since {2,3}R+, the partition of n using twos and as many threes as possible is a feasible, but not necessarily optimal, solution to (1). Thus P(n)P^(n) for each n2. The multiplicative error P^(n)/P(n) grows exponentially with n because the exponent k{n/e,n/e} of (n/k)k grows (increasingly linearly) with n, amplifying the error in the approximation n/ke to each part in the partition underlying P(n).

n P(n) P^(n) P^(n)/P(n)
2 2 2 1.00
3 3 3 1.00
4 4 4 1.00
5 6 6.25 1.04
10 36 39.06 1.09
50 8.61×107 9.70×107 1.13
100 7.41×1015 9.47×1015 1.28
500 3.19×1079 7.66×1079 2.40
1,000 1.01×10159 5.86×10159 5.78

  1. If j>k then i=jkxi=1 by convention. ↩︎

  2. One can derive xi=n/k using the method of Lagrange multipliers. ↩︎