title: Algorithm to determine the "usual" cash payment amounts for a given price
body: <p>You walk into a store, select several products, then go to the counter to pay your bill. The total is some amount (<code>A</code>). You reach into your wallet, purse, or pocket and put down some cash (<code>P</code>), where <code>P</code> >= <code>A</code>, and the cashier gives you change.</p>
  
  <p>Given the set of coins and bills that are in circulation, what are the most likely values for <code>P</code>?</p>
  
  <p>Some examples, assuming that the available bills are $5, $10, $20, $50 and $100, and the available coins are 5c, 10c and 25c:</p>
  
  <p><code>A</code> = $151.24<BR><code>P[1]</code> = $160 (8x$20) or ($100 + 3x$20)<BR><code>P[2]</code> = $155 ($100 + $50 + $5)</p>
  
  <p><code>A</code> = $22.65<BR><code>P[1]</code> = $25 ($20 + $5)<BR><code>P[2]</code> = $30 ($20 + $10)<BR><code>P[3]</code> = $40 ($20 + $20)</p>
  
  <p><code>A</code> = $0.95<BR><code>P[1]</code> = $1 (4 x 25c)<BR><code>P[2]</code> = $5</p>
  
  <p>Many of these numbers seem intuitive, but I have a feeling that the algorithm is difficult to pin down.</p>