All the different ways to add a set of lengths - need explanation of the answer

62 Views Asked by At

I wish to make an integer length n of boards laid down end to end. Each board is an integer length and among boards of one length there are unique types. For example, boards of length one come in two types: "1a", "1b" while boards of length two come in one type: "2" I can make a length 2 combination in these 5 unique ways: (1a,1a)(1a,1b)(1b,1a)(1b,1b), and (2). If I have s(n) boards types of length n, and wish to make a total length n, there are r(n) different ways. The solution is:

r(1) = s(1)

r(2) = s(2) + s(1) r(1)

r(3) = s(3) + s(2) r(1) + s(1) r(2)

r(4) = s(4) + s(3) r(1) + s(2) r(2) + s(1) r(3)

etc.

Where might I find a detailed explanation of why this works? I am thinking this is very basic stuff, since if s(n)=1 for all n, then we are just partitioning the integers.

E.g.

There are 8 ways to make 4: (1,1,1,1)(2,1,1)(1,2,1)(1,1,2)(2,2)(1,3)(3,1),(4) and r(4)=2^(n-1)=8. This is consistent as a particular case of the series above.

I tried wikipedia for partitions, but maybe there is a less opaque intro out there. Thanks.

So, I am also interested is simplifying methods when the s(n) start repeating, e.g. as above. Another example, if s(n)= ..., 2,2,4,2,2,4,2,2,4,... starting from n=4, what math method can I use to turn the rule above into a recursion relation, when all the s(n) are known, so that the coefficients are determined:

r(n) = A r(n-1) + B r(n-2) + C r(n-3) + D r(n-4) + E r(n-5) + F r(n-6)