Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14300

Re: Turning a Sequence into a List?

From Dana DeLouis <dana01@icloud.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Turning a Sequence into a List?
Date 2013-04-25 06:51 +0000
Message-ID <klajpo$39t$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Turning a Sequence into a List? Dana DeLouis <dana01@icloud.com> - 2013-04-25 06:51 +0000

csiph-web