Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Making Change, once more

  • To: mathgroup at
  • Subject: [mg15193] Re: [mg15160] Making Change, once more
  • From: Jurgen Tischer <jtischer at>
  • Date: Fri, 18 Dec 1998 02:11:08 -0500
  • Organization: Universidad del Valle
  • Sender: owner-wri-mathgroup at

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}


Wilson Figueroa wrote:
> Hello Group,
> I have a question pertaining to making change.

  • Prev by Date: Compile and NormalDistribution
  • Next by Date: Re: combinatorics
  • Previous by thread: Re: Re: Compile and NormalDistribution
  • Next by thread: Solving with restrictions on parameters