<p>This is not an answer but maybe this will point you or someone else in the right direction.</p>

<p>I found the paper by D. Kozen and S. Zaks called <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.53.3170&amp;rep=rep1&amp;type=pdf" rel="nofollow noreferrer">"Optimal Bounds for the Change-Making Problem"</a> wherein they give conditions for when a coin change instance's greedy change making algorithm is optimal.  I will use their notation.</p>

<blockquote>
  <p>Given a coin change instance of $m$ distinct coins
  $$ ( c_1, c_2, c_3, \cdots, c_{m-1}, c_{m} ) $$
  $$ c_1 = 1 &lt; c_2 &lt; c_3 &lt; \cdots &lt; c_{m-1} &lt; c_m $$
  a function $M(x)$ representing the optimal number of coins needed to make change for $x$ and a function $G(x)$ representing the number of coins needed to greedily make change for $x$, then if $M(x) \ne G(x)$, there exists a counterexample in the range
  $$ c_3 + 1 &lt; x &lt; c_{m-1} + c_m $$</p>
</blockquote>

<p>They go on to show that</p>

<blockquote>
  <p>If for every $x$ in the range $c_3 + 1 &lt; x &lt; c_{m-1} + c_m $
  $$ G(x) \le G(x-c) + 1$$
  $$ c \in (c_1, c_2, \cdots, c_m )$$
  then $G(x) = M(x)$ (i.e. the greedy algorithm is the optimal).</p>
</blockquote>

<p>This gives us an "efficient" (up to pseudo polynomial time) test to determine whether a coin change instance is greedy or not.</p>

<p>Using the above, I have run a short simulation the results of which are plotted on a log-log scale below</p>

<p><img src="https://i.sstatic.net/qwmEW.png" alt="enter image description here"></p>

<p>Each point represents the average of 10000 instance creations for $m$ shown and each element chosen to be distinct but otherwise uniform and at random from the range of $[1 \cdots N]$.</p>

<p>Given that we know the probability of the greedy algorithm being optimal for $m=3$ goes as $\frac{8}{3} N^{-\frac{1}{2}}$, from just looking at the graph I would hazard a guess that the probability of the greedy algorithm being optimal goes as:</p>

<p>$$ p_m(N) \propto N^{-\frac{(m-2)}{2} } $$</p>

<p>where $p_m(N)$ is the probability that $m$ distinct coins drawn uniformly at random from the range of $N$ is greedy optimal (otherwise known as 'canonical').</p>

<p>In the large $m$ limit, the probability that the greedy solution is optimal goes quickly to 0 for any non-trivial value of $N$.  If the above equation holds, then it is easy to see, but there might be other ways of looking at it that give the same conclusion.  For example, looking at Borgs, Chayes, Mertens and Nair's <a href="http://arxiv.org/pdf/cond-mat/0508600.pdf" rel="nofollow noreferrer">Random Energy Model</a> work indicate that the energy is too jagged at the bottom to expect local moves (i.e. greedy moves) to give an optimal solution.  This is of course for the Number Partition Problem and is only provided to give some intuition rather than a definite answer.</p>

<p>At the risk of answering a question that you did not ask, I wanted to point out that "real world" coin systems do not follow a uniform distribution for coin denominations.  For example, the USA has at least 12 denominations (including bills: $ (1, 5, 10, 25, 50, 100, 200, 500, 1000, 2000, 5000, 10000)$ ) which do not appear to be uniformly distributed.  Perhaps looking at other distributions to generate the coin denominations would yield non-trivial results in the large system limit.  For example, a power law distribution might yield coin denominations that are more similar to the USA's.</p>

CC BY-SA 3.0
2012-04-28T18:39:06.520Z
2012-04-29T05:23:34.490Z
2012-04-29T05:23:34.490Z
user834
<p>Given $n$ coin denominations, with $c_1=1$ and $c_2&lt;c_3&lt;..&lt;c_{n}$ being random numbers uniformly distributed in the range $[2,N]$. Asymptotically, for what fraction of coins does the greedy algorithm generate optimal change using this set of denominations?</p>

<p>The answer is known for <a href="http://www.plambeck.org/oldhtml/mathematics/coinchanging/index.htm" rel="nofollow"> 3 denominations </a>; but what about the general case?</p>

CC BY-SA 2.5
2011-04-05T10:37:06.403Z
Establishing the probability for 4 denominations was posed by Thane Plambeck, who also provided an expression for the probability for 3 denominations (see the link provided by the OP).  The OP is asking a more general question about the asymptotic behaviour of this probability.  This might perhaps be more suitable for math.SE and MO, with tag asymptotics.  @Ganesh: What is your TCS motivation, or the reason for the ds.algorithms tag?
András Salamon
CC BY-SA 2.5
2011-04-05T19:44:26.340Z
@ Andras, this is very much a complexity theory problem. For instance ,if the greedy approach gets optimal solution say 90% of the time, I may as well forget dynamic programming and settle for suboptimal solutions the remaining 10% of the time. Maybe this is more appropriate at Math.*, but the motivation lies in TCS. Finally,the "right tag" escaped me - so I thought that ds.algorithms was the best approximation.
Ganesh
<ds.algorithms>
Asymptotics for Coin changing
Ganesh
# Asymptotics for Coin changing

(Asked by: username_0 on 2011-04-04)

Given $n$ coin denominations, with $c\_1=1$ and $c\_2

The answer is known for  [3 denominations](http://www.plambeck.org/oldhtml/mathematics/coinchanging/index.htm) ; but what about the general case?

**Tags:** ds.algorithms

> **Comments:**
> **username_1**: Establishing the probability for 4 denominations was posed by Thane Plambeck, who also provided an expression for the probability for 3 denominations (see the link provided by the OP).  The OP is asking a more general question about the asymptotic behaviour of this probability.  This might perhaps be more suitable for math.SE and MO, with tag asymptotics.  @username_0: What is your TCS motivation, or the reason for the ds.algorithms tag?  
> **username_0**: @ Andras, this is very much a complexity theory problem. For instance ,if the greedy approach gets optimal solution say 90% of the time, I may as well forget dynamic programming and settle for suboptimal solutions the remaining 10% of the time. Maybe this is more appropriate at Math.*, but the motivation lies in TCS. Finally,the "right tag" escaped me - so I thought that ds.algorithms was the best approximation.  

---

## 1 answers

### Answer by username_2 on 2012-04-28. Score: 9

This is not an answer but maybe this will point you or someone else in the right direction.

I found the paper by D. Kozen and S. Zaks called ["Optimal Bounds for the Change-Making Problem"](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.53.3170&rep=rep1&type=pdf) wherein they give conditions for when a coin change instance's greedy change making algorithm is optimal. I will use their notation.

> Given a coin change instance of $m$ distinct coins
> $$ ( c\_1, c\_2, c\_3, \cdots, c\_{m-1}, c\_{m} ) $$
> $$ c\_1 = 1 < c\_2 < c\_3 < \cdots < c\_{m-1} < c\_m $$
> a function $M(x)$ representing the optimal number of coins needed to make change for $x$ and a function $G(x)$ representing the number of coins needed to greedily make change for $x$, then if $M(x) \ne G(x)$, there exists a counterexample in the range
> $$ c\_3 + 1 < x < c\_{m-1} + c\_m $$

They go on to show that

> If for every $x$ in the range $c\_3 + 1 < x < c\_{m-1} + c\_m $
> $$ G(x) \le G(x-c) + 1$$
> $$ c \in (c\_1, c\_2, \cdots, c\_m )$$
> then $G(x) = M(x)$ (i.e. the greedy algorithm is the optimal).

This gives us an "efficient" (up to pseudo polynomial time) test to determine whether a coin change instance is greedy or not.

Using the above, I have run a short simulation the results of which are plotted on a log-log scale below

![enter image description here](https://i.sstatic.net/qwmEW.png)

Each point represents the average of 10000 instance creations for $m$ shown and each element chosen to be distinct but otherwise uniform and at random from the range of $[1 \cdots N]$.

Given that we know the probability of the greedy algorithm being optimal for $m=3$ goes as $\frac{8}{3} N^{-\frac{1}{2}}$, from just looking at the graph I would hazard a guess that the probability of the greedy algorithm being optimal goes as:

$$ p\_m(N) \propto N^{-\frac{(m-2)}{2} } $$

where $p\_m(N)$ is the probability that $m$ distinct coins drawn uniformly at random from the range of $N$ is greedy optimal (otherwise known as 'canonical').

In the large $m$ limit, the probability that the greedy solution is optimal goes quickly to 0 for any non-trivial value of $N$. If the above equation holds, then it is easy to see, but there might be other ways of looking at it that give the same conclusion. For example, looking at Borgs, Chayes, Mertens and Nair's [Random Energy Model](http://arxiv.org/pdf/cond-mat/0508600.pdf) work indicate that the energy is too jagged at the bottom to expect local moves (i.e. greedy moves) to give an optimal solution. This is of course for the Number Partition Problem and is only provided to give some intuition rather than a definite answer.

At the risk of answering a question that you did not ask, I wanted to point out that "real world" coin systems do not follow a uniform distribution for coin denominations. For example, the USA has at least 12 denominations (including bills: $ (1, 5, 10, 25, 50, 100, 200, 500, 1000, 2000, 5000, 10000)$ ) which do not appear to be uniformly distributed. Perhaps looking at other distributions to generate the coin denominations would yield non-trivial results in the large system limit. For example, a power law distribution might yield coin denominations that are more similar to the USA's.


---

