Re: Making Change, once more
- To: mathgroup at smc.vnet.net
- Subject: [mg15193] Re: [mg15160] Making Change, once more
- From: Jurgen Tischer <jtischer at col2.telecom.com.co>
- Date: Fri, 18 Dec 1998 02:11:08 -0500
- Organization: Universidad del Valle
- Sender: owner-wri-mathgroup at wolfram.com
Sorry, I missed the point in the definition of numberChanges. Of course it should be In[8]:= numberChanges[x_,1]=1; In[9]:= numberChanges[x_,n_]:=numberChanges= Sum[numberChanges[x-k coins[[-n]],n-1],{k,0,Quotient[x,coins[[-n]]]}] In[11]:= numberChanges[x_]:=numberChanges[x,6] In[12]:= numberChanges[100] Out[12]= 293 And now I can get the answer for 10 dollars: In[13]:= Timing[numberChanges[1000]] Out[13]= {1.37 Second,2103596} Jurgen Wilson Figueroa wrote: > > Hello Group, > > I have a question pertaining to making change. > etc.