The coin problem (also referred to as the Frobenius coin problem or Frobenius problem, after the mathematician
Ferdinand Frobenius) is a
mathematical
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
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 has no
common divisor greater than 1.
There is an explicit formula for the Frobenius number when there are only two different coin denominations, ''x'' and ''y'': the Frobenius number is then ''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
In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
computing the Frobenius number in
polynomial time
In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by ...
(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
In computational complexity theory, NP-hardness ( non-deterministic polynomial-time hardness) is the defining property of a class of problems that are informally "at least as hard as the hardest problems in NP". A simple example of an NP-hard pr ...
.
Statement
In mathematical terms the problem can be stated:
:Given positive
integer
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
s ''a''
1, ''a''
2, ..., ''a''
''n'' such that
gcd(''a''
1, ''a''
2, ..., ''a''
''n'') = 1, find the largest integer that ''cannot'' be expressed as an integer
conical combination of these numbers, i.e., as a sum
:: ''k''
1''a''
1 + ''k''
2''a''
2 + ··· + ''k''
''n''''a''
''n'',
:where ''k''
1, ''k''
2, ..., ''k''
''n'' are non-negative integers.
This largest integer is called the Frobenius number of the set , and is usually denoted by ''g''(''a''
1, ''a''
2, ..., ''a''
''n'').
The requirement that the greatest common divisor (GCD) equal 1 is necessary in order for the Frobenius number to exist. If the GCD were not 1, then starting at some number ''m'' the only sums possible are multiples of the GCD; every number past ''m'' that is not divisible by the GCD cannot be represented by any linear combination of numbers from the set. 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
In mathematics, parity is the property of an integer of whether it is even or odd. An integer is even if it is a multiple of two, and odd if it is not.. For example, −4, 0, 82 are even because
\begin
-2 \cdot 2 &= -4 \\
0 \cdot 2 &= 0 \\
41 ...
; 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 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 ''a''
1 = 1 so that all natural numbers can be formed.
''n'' = 2
If ''n'' = 2, the Frobenius number can be found from the formula
. This formula was discovered by
James Joseph Sylvester
James Joseph Sylvester (3 September 1814 – 15 March 1897) was an English mathematician. He made fundamental contributions to matrix theory, invariant theory, number theory, partition theory, and combinatorics. He played a leadership ...
in 1882, although the original source is sometimes incorrectly cited as, in which the author put his theorem as a recreational problem (and did not explicitly state the formula for the Frobenius number).
Sylvester also demonstrated for this case that there are a total of
non-representable (positive) integers.
Another form of the equation for
is given by Skupień in this proposition: If
and
then, for each
, there is exactly one pair of nonnegative integers
and
such that
and
.
The formula is proved as follows. Suppose we wish to construct the number
. Since
, all of the integers
for
are mutually distinct modulo
. Hence there is a unique value of
, say
, and a nonnegative integer
, such that
: Indeed,
because
.
''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 been also determined. The asymptotic lower bound due to Davison
:
is relatively sharp. (
here is the ''modified Frobenius number'' which is the greatest integer not representable by ''positive'' integer linear combinations of
.) Comparison with the actual limit (defined by the parametric relationship,
where
) shows that the approximation is only 1 less than the true value as
. It is conjectured that a similar parametric upper bound (for values of
that are pairwise-coprime and no element is representable by the others) is
where
.
The asymptotic average behaviour of
for three variables is also known:
:
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:
:
The
case above may be expressed as a special case of this formula.
In the event that
, we can omit any subset of the elements
from our arithmetic sequence and the formula for the Frobenius number remains the same.
Geometric sequences
There also exists a closed form solution for the Frobenius number of a set in a
geometric sequence
In mathematics, a geometric progression, also known as a geometric sequence, is a sequence of non-zero numbers where each term after the first is found by multiplying the previous one by a fixed, non-zero number called the ''common ratio''. For e ...
. Given integers ''m'', ''n'', ''k'' with gcd(''m'', ''n'') = 1:
:
: A simpler formula that also displays symmetry between the variables is as follows. Given positive integers
, with
let
. Then
:
: where
denotes the sum of all integers in
Examples
McNugget numbers

One special case of the coin problem is sometimes also referred to as the McNugget numbers. The McNuggets version of the coin problem was introduced by Henri Picciotto, who included it in his algebra textbook co-authored with Anita Wah. Picciotto thought of the application in the 1980s while dining with his son at McDonald's, working the problem out on a napkin. A McNugget number is the total number of
McDonald's
McDonald's Corporation is an American multinational fast food
Fast food is a type of mass-produced food designed for commercial resale, with a strong priority placed on speed of service. It is a commercial term, limited to food sold ...
Chicken McNuggets in any number of boxes. In the
United Kingdom
The United Kingdom of Great Britain and Northern Ireland, commonly known as the United Kingdom (UK) or Britain, is a country in Europe, off the north-western coast of the European mainland, continental mainland. It comprises England, Scotlan ...
, the original boxes (prior to the introduction of the
Happy Meal
A Happy Meal is a kids' meal usually sold at the American fast food restaurant chain McDonald's since June 1979. A small toy or book is included with the food, both of which are usually contained in a red cardboard box with a yellow smiley fa ...
-sized nugget boxes) were of 6, 9, and 20 nuggets.
According to
Schur's theorem, since 6, 9, and 20 are (setwise)
relatively prime
In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equival ...
, any sufficiently large integer can be expressed as a (non-negative, integer)
linear combination of these three. Therefore, there exists a largest non-McNugget number, and all integers larger than it are McNugget numbers. Namely, every positive integer is a McNugget number, with the finite number of exceptions:
: 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 22, 23, 25, 28, 31, 34, 37, and 43 .
Thus the largest non-McNugget number is 43. The fact that any integer larger than 43 is a McNugget number can be seen by considering the following
integer partition
In number theory and combinatorics, a partition of a positive integer , also called an integer partition, is a way of writing as a sum of positive integers. Two sums that differ only in the order of their summands are considered the same part ...
s
:
:
:
:
:
:
Any larger integer can be obtained by adding some number of 6s to the appropriate partition above.
Alternatively, since
and
, the solution can also be obtained by applying a formula presented for
earlier:
:
Furthermore, a straightforward check demonstrates that 43 McNuggets can indeed ''not'' be purchased, as:
# boxes of 6 and 9 alone cannot form 43 as these can only create multiples of 3 (with the exception of 3 itself);
# including a single box of 20 does not help, as the required remainder (23) is also not a multiple of 3; and
# more than one box of 20, complemented with boxes of size 6 or larger, obviously cannot lead to a total of 43 McNuggets.
Since the introduction of the 4-piece Happy Meal-sized nugget boxes, the largest non-McNugget number is 11. In countries where the 9-piece size is replaced with the 10-piece size, there is no largest non-McNugget number, as any odd number cannot be made.
Other examples
In
rugby union
Rugby union, commonly known simply as rugby, is a Contact sport#Terminology, close-contact team sport that originated at Rugby School in the first half of the 19th century. One of the Comparison of rugby league and rugby union, two codes of ru ...
, there are four types of scores: penalty goal (3 points), drop goal (3 points), try (5 points) and converted try (7 points). By combining these any points total is possible except 1, 2, or 4. In
rugby sevens, although all four types of scores are permitted, attempts at penalty goals are rare and drop goals almost unknown. This means that team scores almost always consist of multiples of try (5 points) and converted try (7 points). The following scores (in addition to 1, 2, and 4) cannot be made from multiples of 5 and 7 and so are almost never seen in sevens: 3, 6, 8, 9, 11, 13, 16, 18 and 23. By way of example, none of these scores was recorded in any game in the
2014-15 Sevens World Series.
Similarly, in
American football
American football (referred to simply as football in the United States and Canada), also known as gridiron, is a team sport played by two teams of eleven players on a rectangular field with goalposts at each end. The offense, the team wit ...
, the only way for a team to score exactly one point is if a
safety
Safety is the state of being "safe", the condition of being protected from harm or other danger. Safety can also refer to the control of recognized hazards in order to achieve an acceptable level of risk.
Meanings
There are two slightly di ...
is awarded against the opposing team when they attempt to
convert after a touchdown. As 2 points are awarded for safeties from regular play, and 3 points are awarded for
field goal
A field goal (FG) is a means of scoring in gridiron football. To score a field goal, the team in possession of the ball must place kick, or drop kick, the ball through the goal, i.e., between the uprights and over the crossbar. The entire ba ...
s, all scores other than 1–0, 1–1, 2–1, 3–1, 4–1, 5–1 and 7–1 are possible.
Applications
Shellsort Time Complexity
The
Shellsort
Shellsort, also known as Shell sort or Shell's method, is an in-place comparison sort. It can be seen as either a generalization of sorting by exchange (bubble sort) or sorting by insertion ( insertion sort). The method starts by sorting pairs ...
algorithm is a sorting algorithm whose time complexity is currently an
open problem In science and mathematics, an open problem or an open question is a known problem which can be accurately stated, and which is assumed to have an objective and verifiable solution, but which has not yet been solved (i.e., no solution for it is kno ...
. The worst case complexity has an upper bound which can be given in terms of the Frobenius number of a given sequence of positive integers.
Least Live Weight Problem
Petri nets
A Petri net, also known as a place/transition (PT) net, is one of several mathematical modeling languages for the description of distributed systems. It is a class of discrete event dynamic system. A Petri net is a directed bipartite graph that ...
are useful for modeling problems in
distributed computing
A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...
. For specific kinds of Petri nets, namely conservative weighted circuits, one would like to know what possible "states" or "markings" with a given weight are "live." The problem of determining the least live weight is equivalent to the Frobenius problem.
Terms in Expanded Power of a Polynomial
When a univariate polynomial is raised to some power, one may treat the exponents of the polynomial as a set of integers. The expanded polynomial will contain powers of
greater than the Frobenius number for some exponent (when GCD=1), e.g. for
the set is ' which has a Frobenius number of 29, so a term with
will never appear for any value of
but some value of
will give terms having any power of
greater than 29. When the GCD of the exponents is not 1 then powers larger than some value will only appear if they are a multiple of the GCD, e.g. for
, powers of 24, 27, ... will appear for some value(s) of
but never values larger than 24 that are not multiples of 3 (nor the smaller values, 1-8, 10-14, 16, 17, 19-23).
See also
*
Postage stamp problem
*
Change-making problem
The change-making problem addresses the question of finding the minimum number of coins (of certain denominations) that add up to a given amount of money. It is a special case of the integer knapsack problem, and has applications wider than just ...
*
Sylver coinage
Sylver coinage is a mathematical game for two players, invented by John H. Conway. It is discussed in chapter 18 of
'' Winning Ways for Your Mathematical Plays''. This article summarizes that chapter.
The two players take turns naming positi ...
*
Numerical semigroup
References
{{reflist, colwidth=30em
External links
How to order 43 Chicken McNuggets – Numberphile
Diophantine equations
Recreational mathematics