Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Turning a Sequence into a List?
Replies: 4   Last Post: Apr 25, 2013 2:51 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Dana DeLouis

Posts: 24
Registered: 11/18/12
Re: Turning a Sequence into a List?
Posted: Apr 25, 2013 2:51 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Tuesday, April 16, 2013 12:34:27 AM UTC-4, 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/((1-x) (1-x^5) (1-x^10) (1-x^25) );

SeriesCoefficient[equ,{x,0,52}]
49

= = = = = = =
HTH :>)
Dana DeLouis
Mac & Math 9





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.