9807

Coin Machine

This Demonstration shows a coin machine. Coins are available in denominations of 1, 5, 10, 25, and 50 cents and 1 dollar. Specific coins can be excluded and you can refill the machine. The coin machine can provide change for a given amount of money. Three algorithms are presented: the greedy algorithm, the optimal algorithm for the given system, and a random algorithm.

SNAPSHOTS

  • [Snapshot]
  • [Snapshot]
  • [Snapshot]

DETAILS

A sequence where is called a currency or a coinage system. We always assume that is the smallest coin, so that every cash amount can be represented in the system in at least one way. In our case, any coinage system can be chosen using the coins available in the current US system, but the 1 cent coin must be included.
The change-making problem asks for the most efficient algorithm for the given coinage system (efficient in the sense of using the least number of coins). For most coinage systems, the greedy algorithm (which at each step chooses the maximum possible number of the largest denominations available) is optimal, but this is not true for general systems. Famously, this was not the case for the pre-decimal British coinage system.
The greedy algorithm is optimal for most subsets of ; however, it is not optimal for subsets , , , and . The first amount of money for which these coinage systems are not optimal is 30 cents. This can be verified using the Pearson test (see [1, 2]), which is implemented in this Demonstration. The smallest amount of money for which the optimal algorithm does not give the same answer as the greedy algorithm is 30 cents.
References
[1] M. Kleber, R. Vakil, and J. Shallit, "What This Country Needs Is an 18c Piece," Mathematical Intelligencer 25(2), 2003 pp. 20–23. doi: 10.1007/BF02984830.
[2] M. Adamaszek and A. Niewiarowska, "Combinatorics of the Change-Making Problem," European Journal of Combinatorics 31(1), 2010 pp. 47–63. arXiv:0801.0120v2.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.









 
RELATED RESOURCES
Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2014 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+