note
blokhead
As the other monks observed, the most concise solutions will probably use regular expressions. When looking only at the length of strings, the set of amounts you can represent using $6, $9, and $20 bills is <code>/^(.{6})*(.{9})*(.{20})*$/</code>, or equivalently for our purposes, <code>/^(.{6}|.{9}|.{20})*$/</code>. Now, to get the function arguments into such a regex and find the longest string that doesn't match is the creative part...
<p>
Here are my two 48-character solutions:
<p>
<table border=0><tr><td bgcolor=black color=black>
<tt>$"="}|1{";$_=1x999;chop while/^(1{@_})*$/;length</tt>
<p>
<tt>$"="}|1{";(grep{(1x$_)!~/^(1{@_})*$/}1..999)[-1]</tt>
</td></tr></table>
<p>
And if it weren't for a [http://rt.perl.org/rt3/Ticket/Display.html?id=34195|bug] I just found in alternations within negative lookaheads, I'm pretty sure this would be equivalent, giving me 46 characters:
<p>
<table border=0><tr><td bgcolor=black color=black>
<tt>$"="}|1{";1x999=~/(1*?)(?!(1{@_})*$)/;length$'</tt>
</td></tr></table>
<p>
They all use basically the same idea, can you think of a different approach? As I mentioned in the original post, these work for all instances where (a) the solution is 999 or less, and also (b) the arguments are each less than 32k (because they are used in regex quantifiers).
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-137386">
<p>
blokhead
</div></div>
433169
433169