I've started building raised gardens boxes of custom sizes.
For a given box of width $x$ and length $y$, how many boards of lumber of length $l$ do I need to build this box?
- Assume (for now) the sides of the box are lines. Do not worry about the width of the boards. This also means height is irrelevant. Assume that I buy boards that are always tall enough. This should be treated as a 1-dimensional problem.
- The remainder cut from a side can be used to construct other sides! This is where I'm getting hung up. For example, if $l = 8$, I can make sides of length (4 and 4), (5 and 3), or even (2 and 2 and 2 and 2), etc.
- I cannot mend boards together to make a side. (Practically, it's not as strong as single piece, which is important when you're holding in hundreds of pounds of soil.) This scenario would require a new board of lumber.
- Assume that $l \ge \max(x, y)$. In other words, my boards are always long enough to build a side with just 1 board.
Bonus!: In reality, the boards do have a width, say $w$. Therefore, 2 of the sides should take into account the butt joint from the other sides. For example, in my picture, the $x$ sides actually only require a cut of length $x - 2w$. How would the formula change in this case?

If $x,y$ are the interior measurements of the box you need a total length of $2x+2y-4w$
This can all come from one board of that length, with two pieces $y$ and two pieces $x-2w$
They can come from two boards of length $y+x-2w$ with each cut once.
They can come from three boards of length $\max(y,2x-4w)$
They can come from four boards of length $y$.
You start by asking how long the boards have to be, but then talk about what you can do from a given length. Which direction do you want to go? By making the joints differently you can use boards of length $y-2w$ and $x$, which may help. You could also use boards $y-w, x-w$ if that helps. You also do not talk about making multiple boxes, which raises more possibilities.