Re: Cashbox withdrawal



In article <1134526498.189971.176260@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
kestrel <youssef.mohammed@xxxxxxxxx> wrote:
>:( this is really interesting but it is not helping me anymore. In my
>problem I do have limits on the number of coins to use as i described
>in my first post. And my only concern is to say yes I can change this
>amount or not.

OK, suppose you have n_j of denomination d_j, j = 1..k.
Let S_0 = {0}, and for j from 1 to k let
S_j = S_{j-1} + {i d_j: i=0..n_j}
(where for two sets A and B, A + B = {a + b: a in A, b in B}).
Then S_k is the set of all amounts you can make with these coins.

Alternatively, let P(x) = product_{j=1}^k (1 + x^d_j)^n_j. There is
a way to make y with these coins if and only if the coefficient of
x^y in P(x) is nonzero. I think the efficient way to compute the
coefficients (and thus determine which are zero) is using a Fast Fourier
Transform.

Robert Israel israel@xxxxxxxxxxx
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia Vancouver, BC, Canada
.



Relevant Pages

  • Re: [LogoForum] Re: How can I shrink/grow squares in mswlogo
    ... I would want to say that procedure SQUARES expresses an iteration -- it goes ... to count.change:amount:coins ... (count.change:amount butfirst:coins) ...
    (comp.lang.logo)
  • Re: Making Change (#154)
    ... Ruby is the first programming language I choose.So, ... here you are storing the coins in an instance variable, ... would need to store anyway, so I'd just remove this altogether. ... print "amount should be a positive integer \n" ...
    (comp.lang.ruby)
  • Re: A new banknote for Scotland
    ... It looks like the legal tender statute makes it easy for a debt to be settled in an exact amount, so change does not have to be given, lessening the chance of counter suit for various reasons. ... the statute also ensures that creditors may refuse abnormal amounts of coins for debt settlement. ...
    (soc.culture.scottish)
  • Re: Cashbox withdrawal
    ... In my case, I have limited amount ... > infitine number of coins for each denomination. ... > together with textbook formulas for Taylor expansion. ... but it sounds similar (albeit with just two denominations). ...
    (sci.math)
  • Re: OT? How to tell how much money in coins?
    ... it's not impossible due to the finite amount of all types of coins ever ... halves and 2 1974 aluminum cents will always displace the same exact amount ...
    (rec.collecting.coins)