Combinations of n items that fill the entire volume

170 Views Asked by At

I have a problem and I just cannot derive the general solution.

There is a large box of volume n. We have many small boxes of volume <= n (1, 2, 3 ... n). All the volumes are positive integers. Shape of the boxes isn't relevant, the volume is.

Given the volume of a large box (n), how many different combinations of smaller boxes that fill up the large box are there?

Example:

n=2;

small box of voulme 1 + small box of volume 1 = 2

small box of volume 2 = 2

all in all 2 combinations

n=3;

1 + 1 + 1 = 3

1 + 2 = 3

3 = 3

all in all 3 combinations

n=4;

1 + 1 + 1 + 1 = 4

1 + 1 + 2 = 4

1 + 3 = 4

2 + 2 = 4

4 = 4

all in all 5 combinations

The problem does feel similar to the How many sums from the combination of coins?, however there are many more item/coin volumes/values to choose from.

Any solution/help is appreciated.

Thank you

2

There are 2 best solutions below

0
On

For $n=k$, it is the coefficient of $x^k$ in:

$$\prod_{i=1}^k \frac1{1-x^i}$$

0
On

What you trying to calculate is partition number $p(n)$.

In general partition number is unknown for now. We know only generating function (function coefficients in power series of which give us partition number). Also there is generated a huge number of partitions (https://oeis.org/A000041). But for general $n$ the task is undecidable.