
Re: Turning a Sequence into a List?
Posted:
Apr 25, 2013 2:51 AM


On Tuesday, April 16, 2013 12:34:27 AM UTC4, Rob wrote: > Hello, I'm playing with a problem with minimum coins to make change. > > Here's a problem spot where I look at ways to make up 52 and 53 cents > > (later I'll use v = Range[1,99]. > > v=Range[52,53]; > > sol=(Reduce[25q+10d+5n+p==# &&0<=p<5 &&0<=n<2 &&0<=d<3 > > &&0<=q<4,{q,d,n,p},Integers])& /@v > > (* which gives {(q == 1 && d == 2 && n == 1 && p == 2)  (q == 2 && d > > == 0 && > > n == 0 && p == 2), (q == 1 && d == 2 && n == 1 && > > p == 3)  (q == 2 && d == 0 && n == 0 && p == 3)} *) >
< snip>
Hello. Does this idea help?
coins={p,n,d,q};
Minimize[{Tr[coins],coins.{1,5,10,25}==52,Thread[coins >= 0]},coins,Integers]
{4,{p>2,n>0,d>0,q>2}}
Minimize[{Tr[coins],coins.{1,5,10,25}==53,Thread[coins >= 0]},coins,Integers]
{5,{p>3,n>0,d>0,q>2}}
As a side note, there are 49 ways to make 52 with the given coins.
equ=1/((1x) (1x^5) (1x^10) (1x^25) );
SeriesCoefficient[equ,{x,0,52}] 49
= = = = = = = HTH :>) Dana DeLouis Mac & Math 9

