All possible combinations from a list to sum to X

101 Views Asked by At

I have a maths question I can't wrap my head around.

Assume you have a container of volume X. You need to fill it with 4 types of boxes A, B, C, D of different sizes. A is the smallest box, B is three times bigger than A, C is 30 bigger than B and D is twice as big as C.

So: B = 3A, C = 30B = 90A, D = 2C = 60B = 180A

The capacity of the container is 40D (i.e. the container can hold a maximum of 40 size D boxes at one time).

Question: How many unique combinations of boxes can you have to fill the container? What is the distribution of the number of boxes? (Calculate min, max, mean and 95th percentile)