# Coin problem

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Coin_problem
> Markdown URL: https://mediated.wiki/source/Coin_problem.md
> Source: https://en.wikipedia.org/wiki/Coin_problem
> Source revision: 1345552326
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Mathematical problem}}
{{distinguish|Change-making problem|Coin rotation paradox}}

{{multiple image
 | width = 120
 | image1 = Two_Pence_01.jpg
 | alt1 = Two pence coin
 | image2 = Five_New_Pence.jpg
 | alt2 = Five pence coin
 | footer = With only 2 pence and 5 pence coins, one cannot make 3 pence, but one can make any higher integer amount.
}}
thumb|240px|Frobenius coin problem with 2-pence and 5-pence coins visualised as graphs:
<br/>Sloping lines denote graphs of 2''x''+5''y''=''n'' where ''n'' is the total in pence, and ''x'' and ''y'' are the non-negative number of 2p and 5p coins, respectively.
<br/>A point on a line gives a combination of 2p and 5p for its given total (green).
<br>Multiple points on a line imply multiple possible combinations (blue).
<br/>Only lines with ''n'' = 1 or 3 have no points (red).

In [mathematics](/source/mathematics), the '''coin problem''' (also referred to as the '''Frobenius coin problem''' or '''Frobenius problem''', after the mathematician [Ferdinand Frobenius](/source/Ferdinand_Georg_Frobenius)) is a [mathematical problem](/source/mathematical_problem) that asks for the largest [monetary](/source/monetary) amount that cannot be obtained using only [coin](/source/coin)s of specified [denominations](/source/Denomination_(currency)).<ref name="ramirez2005">{{cite book |last1=Ramírez Alfonsín |first1=Jorge L. |title=The Diophantine Frobenius Problem |date=1 December 2005 |publisher=Oxford University Press |isbn=9780191718229 |url=https://academic.oup.com/book/9257 |access-date=8 December 2025 |language=en}}</ref> 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](/source/Coprime_integers).

There is an explicit formula for the Frobenius number when there are only two different coin denominations, <math> x </math> and <math> y </math>, where the greatest common divisor of these two numbers is 1: <math>xy-x-y</math>. 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](/source/algorithm) for computing the Frobenius [number](/source/number) in [polynomial time](/source/polynomial_time) (in the logarithms of the coin denominations forming an input).<ref name=kannan>{{cite journal |author=Ravi Kannan |year=1992 |title=Lattice translates of a polytope and the Frobenius problem |journal=Combinatorica |volume=12 |issue=2 |pages=161–177 |doi=10.1007/BF01204720|s2cid=19200821 }}</ref> 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](/source/NP-hard).<ref name=beidhoffer>{{cite journal |author1=D. Beihoffer |author2=J. Hendry |author3=A. Nijenhuis |author4=S. Wagon |title=Faster algorithms for Frobenius numbers |journal=Electronic Journal of Combinatorics |year=2005 |volume=12 |pages=R27 |doi=10.37236/1924 |url=http://www.combinatorics.org/Volume_12/Abstracts/v12i1r27.html|doi-access=free }}</ref><ref name=mw>{{MathWorld | urlname=CoinProblem | title=Coin Problem}}</ref>

== Statement ==
In mathematical terms, the problem can be stated:

:Given positive [integer](/source/integer)s  <math>a_1,a_2,\dots,a_n</math>such that [gcd](/source/greatest_common_divisor)<math>(a_1,a_2,\dots,a_n)=1</math>, find the largest integer that ''cannot'' be expressed as an integer [conical combination](/source/conical_combination) of these numbers, i.e., as a sum: <math>k_1a_1+k_2a_2+\dots+k_na_n</math>
:where <math>k_1,k_2,\dots,k_n</math> are non-negative integers.

This largest integer is called the '''Frobenius number''' of the set <math>\{a_1,a_2,\dots,a_n\}</math>, and is usually denoted by <math>g(a_1,a_2,\dots,a_n)</math>

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](/source/Parity_(mathematics)); additionally, [even numbers](/source/Parity_(mathematics)) 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 <math>\{a_1,a_2,\dots,a_n\}</math> is [bounded](/source/Bounded_set) according to [Schur's theorem](/source/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''&nbsp;=&nbsp;1 or&nbsp;2. No closed-form solution is known for ''n''&nbsp;>&nbsp;2.<ref name=mw />

=== ''n'' = 1 ===
If <math>n=1</math>, then we must have <math>a_1=1</math> so that all natural numbers can be formed.

=== ''n'' = 2 ===
If <math>n=2</math>, the Frobenius number can be found from the formula <math>g(a_1, a_2) = a_1a_2-a_1-a_2</math>, which was discovered by [James Joseph Sylvester](/source/James_Joseph_Sylvester) in 1882.<ref>{{cite journal| author = Sylvester, James Joseph | year = 1882| title = On subinvariants, i.e. Semi-Invariants to Binary Quantics of an Unlimited Order| journal = American Journal of Mathematics| volume = 5| issue = 1| page=134 |jstor=2369536| doi = 10.2307/2369536}}</ref>{{refn|group=nb|The original source is sometimes incorrectly cited as,<ref>{{cite journal | author=Sylvester, James Joseph |year = 1884 | title=Question 7382 | journal = Mathematical Questions from the Educational Times| volume = 41| page=21 |url=https://archive.org/stream/mathematicalque05unkngoog#page/n150}}</ref> in which the author put his theorem as a recreational problem{{r|ramirez2005|p=xiii}} (and did not explicitly state the formula for the Frobenius number).}}
Sylvester also demonstrated for this case that there are a total of <math>N(a_1, a_2) =  (a_1-1)(a_2-1)/2</math> non-representable (positive) integers.

Another form of the equation for <math>g(a_1, a_2)</math> is given by Skupień<ref>{{cite journal|last=Skupień|first=Zdzisław|authorlink=Zdzisław Skupień|title=A generalization of Sylvester's and Frobenius' problems|journal=Acta Arithmetica|year=1993|volume=LXV.4|issue=4|pages=353–366|url=http://matwbn.icm.edu.pl/ksiazki/aa/aa65/aa6545.pdf|doi=10.4064/aa-65-4-353-366|doi-access=free}}</ref> in this proposition: If <math>a_1,a_2 \in \mathbb{N}</math> and <math>\gcd(a_1, a_2) = 1</math> then, for each <math>n \ge (a_1-1)(a_2-1)</math>, there is exactly one pair of nonnegative integers <math>\rho</math> and <math>\sigma</math> such that <math>\sigma < a_1</math> and <math>n = \rho a_1 +\sigma a_2</math>.

The formula is proved as follows. Suppose we wish to construct the number <math>n \ge (a_1-1)(a_2-1)</math>. Since <math>\gcd(a_1, a_2) = 1</math>, all of the integers <math>n - j a_2</math> for <math>j=0,1,\ldots,a_1-1</math> are mutually distinct modulo <math>a_1</math>. Thus any integer <math>m</math> must be congruent modulo <math>a_1</math> to one of these residues; in particular, taking <math>m = a_1</math> there is a unique value of <math>j=\sigma \ge 0</math> and a unique integer <math>t</math>,  such that <math> a_1 = n - \sigma a_2 + ta_1 </math>. Rearranging, we have a nonnegative integer <math>\rho = 1-t</math> so that <math>n = \rho a_1 +\sigma a_2</math>.  Indeed, <math>\rho\ge 0</math> because <math>\rho a_1 = n - \sigma a_2 \ge (a_1-1)(a_2-1) - (a_1 -1)a_2 = -a_1 + 1 > (-1)a_1</math>.

To show that exactly half of the integers <math> 0, 1, \ldots, ab - a - b </math> are representable as non-negative integer linear combinations, one first shows that if the integer <math> k \in [0,ab-a-b]</math> is representable, then <math> N - k </math> is not representable, where <math> N = ab-a-b</math>.

One then shows that the converse is true as well: if <math>k</math> is not representable, then <math> N-k </math> is representable. To show this, use the fact that <math> \gcd(a,b) = 1 </math>, which allows us to write <math> k = xa + yb </math>. Reducing and re-arranging the coefficients by adding multiples of <math> ab </math> as necessary, we can assume <math> 0 \le x < b </math> (in fact, this <math> x </math> is the unique such <math> x </math> satisfying the equation and inequalities).

Similarly we take <math> u, v </math> satisfying <math> N - k = ua + vb</math>  and <math>0 \le u < b</math>. Now we can add these equations to write <math> N = (u+x)a + (y+v)b</math> which, using <math> N = ab-a-b</math> yields <math> ab-b(1+y+v) = a(x+u+1)</math>. The integer <math> x+u+1 </math> is positive, because <math>x,u \ge 0</math>. In fact, since the left-hand side of <math> ab-b(1+y+v) = a(x+u+1)</math> is divisible by <math> b</math>, and <math> (a,b)=1</math>, we must have that <math> x+u+1</math> is divisible by <math>b</math>. Yet <math> x,u \le b-1 </math>, so <math> x+u+1 \le 2b-1 </math>, so that <math> x + u + 1 = b </math>. Substituting this into <math> ab-b(1+y+v) = a(x+u+1)</math> and subtracting <math> ab</math> from both sides yields <math>b(1+y+v)=0</math>. So <math>1+y+v = 0</math>. This implies that <math> y+v = -1</math>, which means that exactly one of <math> y</math> or <math> v </math> is negative. If <math> y</math> is negative, then <math> v \ge 0 </math>, which means that <math> N-k = ua + vb</math> is representable; the case when <math> v</math> is negative entails that <math> k </math> is representable.

Thus for any non-negative integer <math> k \in [0,ab-a-b] </math>, we know that exactly one of <math> k </math> or <math> (ab-a-b)-k </math> is representable (and these are distinct, because <math> ab-a-b</math> must be odd as the integers <math> a,b</math> are relatively prime). This shows that half of the integers in the given range are representable; since there are <math> (ab-a-b+1) = (a-1)(b-1) </math> integers in the range <math> [0,ab-a-b] </math>, this gives the desired result.

=== ''n'' = 3 ===
Formulae<ref>{{cite journal |author=Tripathi, A. |title=Formulae for the Frobenius number in three variables |journal=Journal of Number Theory |volume=170 |year=2017 |pages=368–389 |doi=10.1016/j.jnt.2016.05.027|doi-access=free }}</ref> and fast algorithms<ref>See [Numerical semigroups with embedding dimension three](/source/numerical_semigroup) for details of one such algorithm.</ref> 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
:<math>f(a_1, a_2, a_3) \equiv g(a_1, a_2, a_3) + a_1 + a_2 + a_3 \geq \sqrt{3a_1a_2a_3}</math>
is relatively sharp.<ref>{{cite journal |author1=M. Beck |author2=S. Zacks |title=Refined upper bounds for the linear Diophantine problem of Frobenius |journal=Adv. Appl. Math. |volume=32 |year=2004 |pages=454–467 |doi=10.1016/S0196-8858(03)00055-1 |arxiv=math/0305420 |issue=3|s2cid=119174157 }}</ref> (<math>f</math> here is the ''modified Frobenius number,'' which is the greatest integer not representable by ''positive'' integer linear combinations of <math>a_1, a_2, a_3</math>.)

The asymptotic average behaviour of <math>f</math> for three variables is also known as:<ref>{{cite journal |author=Ustinov, A. |title=The solution of Arnold's problem on the weak asymptotics of Frobenius numbers with three arguments|journal=Sbornik: Mathematics|volume=200|number=4|year=2009|pages=131–160|doi=10.1070/SM2009v200n04ABEH004011|bibcode=2009SbMat.200..597U}}</ref>
:<math>f(a_1, a_2, a_3) \sim \frac8{\pi}\sqrt{a_1a_2a_3},</math>

== Wilf's conjecture ==

In 1978, Wilf conjectured that given coprime integers <math>a_1<a_2<...<a_d</math>, and their Frobenius number <math>F</math>, we have
:<math>d\geq\frac{F+1}{F+1-g},</math>
where <math>g</math> denotes the number of all non-representable positive integers.<ref>{{cite journal|author=Wilf, H.S.|year=1978|title=A Circle-Of-Lights Algorithm for the "Money-Changing Problem"|journal=The American Mathematical Monthly|volume=85|issue=7|pages=562–565|doi=10.2307/2320864 |jstor=2320864 |url=https://www.jstor.org/stable/2320864|url-access=subscription}}</ref> In 2015, an asymptotic version of this was proven by Moscariello and Sammartano.<ref>{{cite journal|author1=Moscariello, A. |author2=Sammartano, A.|year=2015|title=On a Conjecture by Wilf About the Frobenius Number|journal=Mathematische Zeitschrift|volume=280|issue=1–2 |pages=47–53|doi=10.1007/s00209-015-1412-0|arxiv=1408.5331}}</ref>

== Frobenius numbers for special sets ==

=== Arithmetic sequences ===
A simple formula exists for the Frobenius number of a set of integers in an [arithmetic sequence](/source/arithmetic_sequence).{{r|ramirez2005|p=59-60}} Given integers ''a'', ''d'', ''w'' with gcd(''a'',&nbsp;''d'')&nbsp;=&nbsp;1:

: <math>g(a,a+d,a+2d,\dots,a+wd)=\left(\left\lfloor\frac{a-2}{w}\right\rfloor\right)a+d(a-1)</math>

The <math>n=2</math> case above may be expressed as a special case of this formula.

In the event that <math> a > w^2-3w+1 </math>, we can omit any subset of the elements <math> a+2d, a+3d, ..., a+(w-3)d, a+(w-2)d </math> from our arithmetic sequence and the formula for the Frobenius number remains the same.<ref>{{cite journal |last1= Lee|first1= S.H. |last2=O'neill |first2= C. |last3=Van Over |first3= B.|year= 2019 |title= On arithmetical numerical monoids with some generators omitted |journal= Semigroup Forum |volume= 98 |issue= 2 |pages= 315–326|doi= 10.1007/s00233-018-9952-3|arxiv= 1712.06741 |s2cid= 119143449 }}</ref>

=== Geometric sequences ===
There also exists a closed form solution for the Frobenius number of a set in a [geometric sequence](/source/geometric_sequence).<ref>{{cite journal |author1 = Ong, Darren C. |author2 = Ponomarenko, Vadim |year = 2008 |title = The Frobenius Number of Geometric Sequences |journal = INTEGERS: The Electronic Journal of Combinatorial Number Theory |volume = 8 |issue = 1 |pages = A33 |url = http://www.emis.de/journals/INTEGERS/papers/i33/i33.Abstract.html |access-date = 2010-01-04 }}</ref> Given integers ''m'', ''n'', ''k'' with gcd(''m'',&nbsp;''n'')&nbsp;=&nbsp;1:

: <math>g(m^k,m^{k-1}n,m^{k-2}n^2,\dots,n^k)=n^{k-1}(mn-m-n)+\frac{m^2(n-1)(m^{k-1}-n^{k-1})}{m-n}.</math>
: A simpler formula that also displays symmetry between the variables is as follows. Given positive integers <math>a,b,k</math>, with <math>\gcd(a,b)=1,</math> let <math>A_k(a,b) = \{a^k, a^{k-1}b, \ldots, b^k\}</math>. Then <ref>{{Cite journal|title = On the Frobenius Problem for Geometric Sequences, Article A43|last = Tripathi|first = Amitabha|journal = INTEGERS: The Electronic Journal of Combinatorial Number Theory|volume= 8|issue=1|year= 2008}}</ref>
: <math>g(A_k(a,b))={\sigma}_{k+1}(a,b) - {\sigma}_k(a,b) - (a^{k+1} + b^{k+1}),</math>
: where <math>{\sigma}_k(a,b)</math> denotes the sum of all integers in <math>A_k(a,b).</math>

== Examples and applications ==

=== McNugget numbers ===
[[File:Chicken McNuggets.jpg|thumb|A box of 20 [Chicken McNuggets](/source/Chicken_McNuggets)]]
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 placed it as a puzzle in <em>Games Magazine</em> in 1987,<ref>{{cite journal| first=Henri|last=Picciotto|title=Math McPuzzle|year=1987|issue=April/May|page=52|volume=85|url=https://archive.org/details/games-85-1987-april/page/n53/mode/2up|journal=Games Magazine}}</ref> and included it in his algebra textbook co-authored with Anita Wah.<ref>{{cite book |first1=Anita|last1=Wah|first2=Henri|last2=Picciotto |chapter=Lesson 5.8 Building-block Numbers |chapter-url=http://www.mathedpage.org/attc/lessons/ch.05/5.08-building-blocks.pdf |title= Algebra: Themes, Tools, Concepts |year=1994 |page=186}}</ref> Picciotto thought of the application in the 1980s while dining with his son at McDonald's, working out the problem on a napkin. A McNugget number is the total number of [McDonald's](/source/McDonald's) [Chicken McNuggets](/source/Chicken_McNuggets) in any number of boxes. In the [United Kingdom](/source/United_Kingdom), the original boxes (prior to the introduction of the [Happy Meal](/source/Happy_Meal)–sized nugget boxes) were of 6, 9, and 20 nuggets.

According to [Schur's theorem](/source/Schur's_theorem), since 6, 9, and 20 are (setwise) [relatively prime](/source/Coprime_integers), any sufficiently large integer can be expressed as a (non-negative, integer) [linear combination](/source/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 {{OEIS|id=A065003}}.
{| class="wikitable" style="float:right;clear:right;margin-left:1ex;font-size:90%;"
! style="padding:0;"|Total !! 0 !! 1 !! 2 !! 3 !! 4 !! 5
|-
! +0
| bgcolor="#ccffff"|{{figure space}}0:{{blue|0}},{{purple|0}},{{red|0}}||bgcolor="#ffffff"|{{figure space}}1: &mdash;             ||bgcolor="#ffffff"|{{figure space}}2: &mdash;
| bgcolor="#ffffff"|{{figure space}}3: &mdash;                         ||bgcolor="#ffffff"|{{figure space}}4: &mdash;             ||bgcolor="#ffffff"|{{figure space}}5: &mdash;
|-
! +6
| bgcolor="#ccffff"|{{figure space}}6:{{blue|1}},{{purple|0}},{{red|0}}||bgcolor="#ffffff"|{{figure space}}7: &mdash;             ||bgcolor="#ffffff"|{{figure space}}8: &mdash;
| bgcolor="#ccccff"|{{figure space}}9:{{blue|0}},{{purple|1}},{{red|0}}||bgcolor="#ffffff"|10: &mdash;                   ||bgcolor="#ffffff"|11: &mdash;
|-
! +12
| bgcolor="#ccffff"|12:{{blue|2}},{{purple|0}},{{red|0}}     ||bgcolor="#ffffff"|13: &mdash;                    ||bgcolor="#ffffff"|14: &mdash;
| bgcolor="#ccccff"|15:{{blue|1}},{{purple|1}},{{red|0}}     ||bgcolor="#ffffff"|16: &mdash;                    ||bgcolor="#ffffff"|17: &mdash;
|- style="border-top:2px dotted;"
! +18
| bgcolor="#ccffff"|18:{{blue|3}},{{purple|0}},{{red|0}}||bgcolor="#ffffff"|19: &mdash;                         ||bgcolor="#ccffcc"|20:{{blue|0}},{{purple|0}},{{red|1}}
| bgcolor="#ccccff"|21:{{blue|2}},{{purple|1}},{{red|0}}||bgcolor="#ffffff"|22: &mdash;                         ||bgcolor="#ffffff"|23: &mdash;
|-
! +24
| bgcolor="#ccffff"|24:{{blue|4}},{{purple|0}},{{red|0}}||bgcolor="#ffffff"|25: &mdash;                         ||bgcolor="#ccffcc"|26:{{blue|1}},{{purple|0}},{{red|1}}
| bgcolor="#ccccff"|27:{{blue|3}},{{purple|1}},{{red|0}}||bgcolor="#ffffff"|28: &mdash;                         ||bgcolor="#99cc99"|29:{{blue|0}},{{purple|1}},{{red|1}}
|-
! +30
| bgcolor="#ccffff"|30:{{blue|5}},{{purple|0}},{{red|0}}||bgcolor="#ffffff"|31: &mdash;                         ||bgcolor="#ccffcc"|32:{{blue|2}},{{purple|0}},{{red|1}}
| bgcolor="#ccccff"|33:{{blue|4}},{{purple|1}},{{red|0}}||bgcolor="#ffffff"|34: &mdash;                         ||bgcolor="#99cc99"|35:{{blue|1}},{{purple|1}},{{red|1}}
|- style="border-top:2px dotted;"
! +36
| bgcolor="#ccffff"|36:{{blue|6}},{{purple|0}},{{red|0}}||bgcolor="#ffffff"|37: &mdash;                         ||bgcolor="#ccffcc"|38:{{blue|3}},{{purple|0}},{{red|1}}
| bgcolor="#ccccff"|39:{{blue|5}},{{purple|1}},{{red|0}}||bgcolor="#ffff99"|40:{{blue|0}},{{purple|0}},{{red|2}}||bgcolor="#99cc99"|41:{{blue|2}},{{purple|1}},{{red|1}}
|-
! +42
| bgcolor="#ccffff"|42:{{blue|7}},{{purple|0}},{{red|0}}||bgcolor="#ffffff" style="border:solid;"|43: &mdash; || bgcolor="#ccffcc" |44:{{blue|4}},{{purple|0}},{{red|1}}
| bgcolor="#ccccff"|45:{{blue|6}},{{purple|1}},{{red|0}}||bgcolor="#ffff99"|46:{{blue|1}},{{purple|0}},{{red|2}}||bgcolor="#99cc99"|47:{{blue|3}},{{purple|1}},{{red|1}}
|-
! +48
| bgcolor="#ccffff"|48:{{blue|8}},{{purple|0}},{{red|0}}||bgcolor="#ffcc99"|49:{{blue|0}},{{purple|1}},{{red|2}}||bgcolor="#ccffcc"|50:{{blue|5}},{{purple|0}},{{red|1}}
| bgcolor="#ccccff"|51:{{blue|7}},{{purple|1}},{{red|0}}||bgcolor="#ffff99"|52:{{blue|2}},{{purple|0}},{{red|2}}||bgcolor="#99cc99"|53:{{blue|4}},{{purple|1}},{{red|1}}
|-
! +54
| bgcolor="#ccffff"|54:{{blue|9}},{{purple|0}},{{red|0}}||bgcolor="#ffcc99"|55:{{blue|1}},{{purple|1}},{{red|2}}||bgcolor="#ccffcc"|56:{{blue|6}},{{purple|0}},{{red|1}}
| bgcolor="#ccccff"|57:{{blue|8}},{{purple|1}},{{red|0}}||bgcolor="#ffff99"|58:{{blue|3}},{{purple|0}},{{red|2}}||bgcolor="#99cc99"|59:{{blue|5}},{{purple|1}},{{red|1}}
|-
| colspan="7"|A possible set of combinations of boxes for a total of 0 to 59 nuggets.<br/>Each triplet denotes the number of boxes of '''{{blue|6}}''', '''{{purple|9}}''' and '''{{red|20}}''', respectively.
|}
Thus the largest non–McNugget number is 43.<ref>{{MathWorld | urlname=McNuggetNumber | title=McNugget Number}}</ref> The fact that any integer larger than 43 is a McNugget number can be seen by considering the following [integer partition](/source/integer_partition)s
:<math>44 = 6 + 6 + 6 + 6 + 20</math>
:<math>45 = 9 + 9 + 9 + 9 + 9</math>
:<math>46 = 6 + 20 + 20</math>
:<math>47 = 9 + 9 + 9 + 20</math>
:<math>48 = 6 + 6 + 9 + 9 + 9 + 9</math>
:<math>49 = 9 + 20 + 20</math>
Any larger integer can be obtained by adding some number of 6s to the appropriate partition above. 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](/source/rugby_union), 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](/source/rugby_sevens), although all four types of scoring are permitted, attempts at penalty goals are rare, and drop goals are almost unknown. This means that team scores almost always consist of multiples of tries (5 points) and converted tries (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](/source/2014-15_Sevens_World_Series).

Similarly, in [American football](/source/American_football), the only way for a team to score exactly one point is if a [safety](/source/safety_(American_football_score)) is awarded against the opposing team when they attempt to [convert](/source/conversion_(gridiron_football)) after a touchdown (which in this case has a value of 6). As 2 points are awarded for safeties from regular play, and 3 points are awarded for [field goal](/source/Field_goal_(football))s, all scores other than 1–0, 1–1, 2–1, 3–1, 4–1, 5–1 and 7–1 are possible. This is directly related to the concept of [Scorigami](/source/Scorigami).

=== Shellsort time complexity ===
The [Shellsort](/source/Shellsort) algorithm is a [sorting algorithm](/source/sorting_algorithm) whose time complexity is currently an [open problem](/source/open_problem). 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](/source/Petri_nets) are useful for modeling problems in [distributed computing](/source/distributed_computing). 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](/source/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 <math>x</math> greater than the Frobenius number for some exponent (when GCD=1), e.g., for <math>(1 + x^6 + x^7)^n</math> the set is ''{6, 7}'' which has a Frobenius number of 29, so a term with <math>x^{29}</math> will never appear for any value of <math>n</math> but some value of <math>n</math> will give terms having any power of <math>x</math> 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 <math>(1+x^9+x^{15})^n</math>, powers of 24, 27,... will appear for some value(s) of <math>n</math> 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](/source/Postage_stamp_problem)
* [Change-making problem](/source/Change-making_problem)
* [Sylver coinage](/source/Sylver_coinage)
* [Numerical semigroup](/source/Numerical_semigroup)

== Notes ==
{{reflist|group=nb}}

== References ==
{{reflist|colwidth=30em}}

==Further reading==
* {{cite journal |last1=Bocker |first1=Sebastian |last2=Liptak |first2=Zsuzsanna |title=A Fast and Simple Algorithm for the Money Changing Problem |journal=Algorithmica |date=August 2007 |volume=48 |issue=4 |pages=413–432 |doi=10.1007/s00453-007-0162-8 |url=https://link.springer.com/article/10.1007/s00453-007-0162-8 |access-date=8 December 2025}}
* {{cite journal |last1=Einstein |first1=D. |last2=Lichtblau |first2=D. |last3=Strzebonski |first3=A. |last4=Wagon |first4=S. |title=Frobenius Numbers by Lattice Point Enumeration |journal=Integers: Electronic Journal of Combinatoric Number Theory |date=26 March 2007 |volume=7 |doi=10.5281/zenodo.8278507 |url=https://math.colgate.edu/~integers/vol7.html |access-date=8 December 2025}} {{snd}} describes algorithm built into [Mathematica](/source/Mathematica)
*{{cite journal | last1 = Tuenter | first1 = Hans J. H. | doi = 10.1016/j.jnt.2005.06.015 | title = The Frobenius problem, sums of powers of integers, and recurrences for the Bernoulli numbers | journal = Journal of Number Theory | volume = 117 | issue = 2 | pages = 376–386 |date=April 2006| doi-access = free | mr = 2213771 
| zbl = 1097.11010}}

== External links ==
* [https://www.youtube.com/watch?v=vNTSugyS038 How to order 43 Chicken McNuggets – Numberphile]

Category:Diophantine equations
Category:Recreational mathematics

---
Adapted from the Wikipedia article [Coin problem](https://en.wikipedia.org/wiki/Coin_problem) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Coin_problem?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
