1

I would like to know if the following question has an intelligent solution:

Determine the largest bet that cannot be made using chips of $7$ and $9$ dollars.

After not being able to solve it I found a solution online which writes out all combinations of $7$ and $9$ up to $90$ and then notes that we can produce all numbers after $47$ so the largest bet is $47$.

Then after asking this question here on the site I got pointed to the formula for the Frobenius number on Wikipedia: $g(a,b) = ab - a- b$. But Wikipedia does not explain this formula.

How to derive this formula? Why is the Frobenius number for two coins $ab - a - b$ where $a,b$ are the denominations of the coins?

a student
  • 4,445
  • 2
    This is known as the ''coin problem'' in some circles. Wikipedia has a helpful article; see specifically the case $n = 2$: https://en.wikipedia.org/wiki/Coin_problem#n_.3D_2. The following article might also be helpful: http://cosmos.ucdavis.edu/archives/2009/cluster6/Chen_Kevin.pdf – Alex Wertheim Oct 20 '15 at 06:58
  • 2
    Hint: $47=7\cdot9-7-9.$ This works for any pair of relatively prime numbers. – bof Oct 20 '15 at 06:59
  • @AlexWertheim Thank you, your comment helped me greatly. – a student Oct 20 '15 at 07:50
  • @AlexWertheim I wish Wikipedia would explain why $g(a_1,a_2) =a_1a_2 - a_1 - a_2$. – a student Oct 20 '15 at 07:53

2 Answers2

3

A very nice explanation is given at Cut the knot.

You want the number for $p, q$ with $\gcd(p, q) = 1$ (otherwise it makes no sense). Consider the $q$ sequences:

$\begin{align} &0 + 0, 0 + q, 0 + 2 q, \dotsc \\ &p + 0, p + q, p + 2 q, \dotsc \\ &\vdots \\ &(q - 1) p + 0, (q - 1) p + q, \dotsc \end{align}$

They have no elements in common. Now take the series:

$\begin{align} \sum_{k \ge 0} z^{r p + k q} &= z^{r p} \sum_{k \ge 0} z^{k q} \\ &= \frac{z^{r p}}{1 - z^q} \end{align}$

Add them all up:

$\begin{align} \sum_{0 \le r \le q - 1} \frac{z^{r p}}{1 - z^q} &= \frac{1}{1 - z^q} \sum_{0 \le r \le q - 1} z^{r p} \\ &= \frac{1}{1 - z^q} \frac{1 - z^{q p}}{1 - z^p} \\ &= \frac{1 - z^{p q}}{(1 - z^p) (1 - z^q)} \end{align}$

The coefficients of this are all 0 (the number isn't representable) or 1 (the number is representable). We get the series with 1 for non-representable ones by:

$\begin{align} \frac{1}{1 - z} - \frac{1 - z^{p q}}{(1 - z^p) (1 - z^q)} &= \frac{(1 - z^p) (1 - z^q) - (1 - z) (1 - z^{p q})} {(1 - z) (1 - z^p) (1 - z^q)} \end{align}$

This is a polynomial (it is easy to see that large enough numbers are all representable). Its degree is the last non-representable number, and that is just the degree of the numerator less the degree of the denominator:

$\begin{align} (1 + p q) - (p + q + 1) = p q - p - q \end{align}$

As the coefficients are all 1, we can also get the number of non-representable ones as:

$\begin{align} \lim_{z \to 1} \frac{(1 - z^p) (1 - z^q) - (1 - z) (1 - z^{p q})} {(1 - z) (1 - z^p) (1 - z^q)} \end{align}$

Applying l'Hôpital thrice gives:

$\begin{align} \frac{−3 p q (p q − p − q + 1)}{- 6 p q} = \frac{p q - p - q + 1}{2} \end{align}$

vonbrand
  • 28,394
  • 2
    Thank you very much. This turns out to be longer than I expected. I will take some time to read your answer. – a student Oct 23 '15 at 11:26
  • @astudent hope this helps, it id the clearest proof I've seen. And thanking around here is by up voting and/or accepting answers. Hope this hels – vonbrand Oct 23 '15 at 13:22
3

It helps to imagine $a<b$. As ${\rm gcd}(a,b)=1$ the $a$ numbers $$r_j:=j\>b\quad(0\leq j\leq a-1)$$ represent the $a$ different remainders modulo $a$. At the same time $r_j$ is the smallest representable number having that remainder modulo $a$: You need at least $j$ summands $b$ to produce that remainder. It follows that all numbers $r_j+k\>a$ $(k\geq 0)$ are representable, but $r_j-a$, $\>r_j-2a$, $\>\ldots\>$, are not. Since $r_{a-1}$ is the largest of the $r_j$ the largest non-representable number $g(a,b)$ is given by $$g(a,b)=r_{a-1}-a=ab-a-b\ .$$