MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Turning a Sequence into a List?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130598] Re: Turning a Sequence into a List?
  • From: Dana DeLouis <dana01 at icloud.com>
  • Date: Thu, 25 Apr 2013 02:52:44 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

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




  • Prev by Date: Export to PDF outline issues
  • Next by Date: Re: memory issue
  • Previous by thread: Re: Turning a Sequence into a List?
  • Next by thread: Re: Turning a Sequence into a List?