In mathematics, the coin problem (also referred to as the Frobenius coin problem or Frobenius problem, after the mathematician Ferdinand Frobenius) is a mathematical problem that asks for the largest monetary amount that cannot be obtained using only coins of specified denominations. For example, the largest amount that cannot be obtained using only coins of 3 and 5 units is 7 units. The solution to this problem for a given set of coin denominations is called the Frobenius number of the set. The Frobenius number exists as long as the set of coin denominations is setwise coprime. There is an explicit formula for the Frobenius number when there are only two different coin denominations, x and y, where the greatest common divisor of these two numbers is 1: xy−x−y. If the number of coin denominations is three or more, no explicit formula is known. However, for any fixed number of coin denominations, there is an algorithm for computing the Frobenius number in polynomial time (in the logarithms of the coin denominations forming an input). No known algorithm is polynomial time in the number of coin denominations, and the general problem, where the number of coin denominations may be as large as desired, is NP-hard.
Statement In mathematical terms, the problem can be stated:
Given positive integers a1,a2,…,ansuch that gcd(a1,a2,…,an)=1, find the largest integer that cannot be expressed as an integer conical combination of these numbers, i.e., as a sum: k1a1+k2a2+⋯+knan where k1,k2,…,kn are non-negative integers. This largest integer is called the Frobenius number of the set {a1,a2,…,an}, and is usually denoted by g(a1,a2,…,an) The existence of the Frobenius number depends on the condition that the greatest common divisor (GCD) is equal to 1. Indeed, the potential sums are multiples of the GCD in all cases. Hence, if it is not 1, then there are always arbitrarily large numbers that cannot be obtained as sums. For example, if you had two types of coins valued at 6 cents and 14 cents, the GCD would equal 2, and there would be no way to combine any number of such coins to produce a sum which was an odd number; additionally, even numbers 2, 4, 8, 10, 16 and 22 (less than m=24) could not be formed, either. On the other hand, whenever the GCD equals 1, the set of integers that cannot be expressed as a conical combination of {a1,a2,…,an} is bounded according to Schur's theorem, and therefore the Frobenius number exists.
Frobenius numbers for small n A closed-form solution exists for the coin problem only where n = 1 or 2. No closed-form solution is known for n > 2.
n = 1 If n=1, then we must have a1=1 so that all natural numbers can be formed.
n = 2 If n=2, the Frobenius number can be found from the formula g(a1,a2)=a1a2−a1−a2, which was discovered by James Joseph Sylvester in 1882. Sylvester also demonstrated for this case that there are a total of N(a1,a2)=(a1−1)(a2−1)/2 non-representable (positive) integers. Another form of the equation for g(a1,a2) is given by Skupień in this proposition: If a1,a2∈ℕ and gcd(a1,a2)=1 then, for each n≥(a1−1)(a2−1), there is exactly one pair of nonnegative integers ρ and σ such that σ<a1 and n=ρa1+σa2. The formula is proved as follows. Suppose we wish to construct the number n≥(a1−1)(a2−1). Since gcd(a1,a2)=1, all of the integers n−ja2 for j=0,1,…,a1−1 are mutually distinct modulo a1. Thus any integer m must be congruent modulo a1 to one of these residues; in particular, taking m=a1 there is a unique value of j=σ≥0 and a unique integer t, such that a1=n−σa2+ta1. Rearranging, we have a nonnegative integer ρ=1−t so that n=ρa1+σa2. Indeed, ρ≥0 because ρa1=n−σa2≥(a1−1)(a2−1)−(a1−1)a2=−a1+1>(−1)a1. To show that exactly half of the integers 0,1,…,ab−a−b are representable as non-negative integer linear combinations, one first shows that if the integer k∈[0,ab−a−b] is representable, then N−k is not representable, where N=ab−a−b. One then shows that the converse is true as well: if k is not representable, then N−k is representable. To show this, use the fact that gcd(a,b)=1, which allows us to write k=xa+yb. Reducing and re-arranging the coefficients by adding multiples of ab as necessary, we can assume 0≤x<b (in fact, this x is the unique such x satisfying the equation and inequalities). Similarly we take u,v satisfying N−k=ua+vb and 0≤u<b. Now we can add these equations to write N=(u+x)a+(y+v)b which, using N=ab−a−b yields ab−b(1+y+v)=a(x+u+1). The integer x+u+1 is positive, because x,u≥0. In fact, since the left-hand side of ab−b(1+y+v)=a(x+u+1) is divisible by b, and (a,b)=1, we must have that x+u+1 is divisible by b. Yet x,u≤b−1, so x+u+1≤2b−1, so that x+u+1=b. Substituting this into ab−b(1+y+v)=a(x+u+1) and subtracting ab from both sides yields b(1+y+v)=0. So 1+y+v=0. This implies that y+v=−1, which means that exactly one of y or v is negative. If y is negative, then v≥0, which means that N−k=ua+vb is representable; the case when v is negative entails that k is representable. Thus for any non-negative integer k∈[0,ab−a−b], we know that exactly one of k or (ab−a−b)−k is representable (and these are distinct, because ab−a−b must be odd as the integers a,b are relatively prime). This shows that half of the integers in the given range are representable; since there are (ab−a−b+1)=(a−1)(b−1) integers in the range [0,ab−a−b], this gives the desired result.
n = 3 Formulae and fast algorithms are known for three numbers though the calculations can be very tedious if done by hand. Simpler lower and upper bounds for Frobenius numbers for n = 3 have also been determined. The asymptotic lower bound due to Davison
f(a1,a2,a3)≡g(a1,a2,a3)+a1+a2+a3≥3a1a2a3 is relatively sharp. (f here is the modified Frobenius number, which is the greatest integer not representable by positive integer linear combinations of a1,a2,a3.) The asymptotic average behaviour of f for three variables is also known as:
f(a1,a2,a3)∼8πa1a2a3,
Wilf's conjecture In 1978, Wilf conjectured that given coprime integers a1<a2<...<ad, and their Frobenius number F, we have
d≥F+1F+1−g, where g denotes the number of all non-representable positive integers. In 2015, an asymptotic version of this was proven by Moscariello and Sammartano.
Frobenius numbers for special sets
Arithmetic sequences A simple formula exists for the Frobenius number of a set of integers in an arithmetic sequence. Given integers a, d, w with gcd(a, d) = 1:
… excerpt ends here. Continue reading the full article.




