You need to build a wall of length no longer than $1000$ cm. You can use bricks of three sizes: $23$ cm, $27$ cm or $36$ cm, and you are not allowed to cut bricks.
What is the maximum length which you won't be able to lay?
For example, you can lay a brick wall of length 469 cm, because $11\cdot 23 + 6 \cdot 36 = 469$.
I was able to find that the answer is 229 with a simple dynamic programming algorithm. That does solve the problem, but I'd love to know if there's a more "mathematical" way to approach it.
I tried playing with some modulo arithmetic on the equation $23a+27b+36c=n$, but that didn't get me too far.
Any kind of help would be appreciated.
Apart from having an upper limit of 1000, I believe this is basically what is known as the Frobenius, Postage Stamp or Chicken McNugget problem. According to https://brilliant.org/wiki/postage-stamp-problem-chicken-mcnugget-theorem/ :
Thus, apart from the result being no larger than your maximum allowed, this shows that for even your example with $3$ variables, there is no general solution. I don't know of any way to handle restricting the result to within a specified maximum as well, with this likely making the problem even more difficult to solve, but perhaps somebody else can answer this or suggest something.