FROBENIUS is a collection of Mathematica routines for the solution of Frobenius's problem.
Frobenius's problem assumes that there are N denominations of coins, A1 through AN, and asks for the largest quantity that cannot be formed using any combination of the coins.
It is assumed that the denominations are all positive integers.
The problem is "impossible" if the denominations have a common factor greater than 1 - impossible in the sense that in this case there are an infinite number of quantitities that cannot be formed. On the other hand, if the denominations do not all share a common factor greater than 1, then there is always a finite solution, that is, a largest quantity that cannot be formed by the denominations. In this case, the value is called the Frobenius number, and symbolized by g(A1,A2,...AN).
The case of two denominations is easy:
g(a,b) = a*b - a - bHowever, the case of three denominations is hard, and for general N, the problem is NP-hard!
In an example inspired by the "denominations" of McDonald's MacNuggets, there are 3 denominations, 6, 9, and 20, and it can be shown that the number 43 is the largest value that cannot be formed by combinations of these denominations.
Note that Mathematica has a built in command that can compute the Frobenius number:
FrobeniusNumber [ { 6, 9, 20 } ]
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
You can go up one level to the Mathematica packages and notebooks.