<s>[INST] Deriving Frobenius number for two denominations? 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?

 [/INST] 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}$
</s>