AlgoWiki

Frobenius coin problem

Given a list of positive integers a1,…,ana_1,\ldots,a_n, the Frobenius coin problem asks for the largest integer NN such that the equation

x1a1+⋯+xnan=Nx_1 a_1 + \cdots + x_n a_n = N

has no solutions where xix_i are nonnegative integers. This integer is denoted as g(a1,…,an)g(a_1,\ldots,a_n)

A related question asks whether a given NN has such a solution. A necessary (albeit not sufficient) condition is that NN is divisible by G=gcd(a1,…,an)G = \mathrm{gcd}(a_1,\ldots,a_n). However, it can be shown that, if A=max⁡iaiA = \max_i a_i, any N>A2N>A^2 has such a solution iff. NN is divisible by GGneed Thus the Frobenius coin problem is only well defined when G=1G=1

These problems are NP-Hard, although they can be solved in pseudo-polynomial time O(na1log⁡(na1))O(na_1\log(na_1))12

Identities for small nn

n=2n=2

There is a closed-form solution for n=2n=2

g(a1,a2)=a1a2−a1−a2g(a_1,a_2) = a_1a_2 - a_1 - a_2

Furthermore, the number of integers that don't have a solution is given by the formula:

N(a1,a2)=(a1−1)(a2−1)/2N(a_1,a_2) = (a_1-1)(a_2-1)/2

n=3n=3

There is no known closed-form solution for n=3n=3, although the following equality is known to hold:need

g(d⋅a1,d⋅a2,a3)=d⋅g(a1,a2,a3)+a3(d−1)g(d\cdot a_1, d\cdot a_2, a_3) = d\cdot g(a_1,a_2,a_3) + a_3(d-1)

Problems

See also