Coin problem

From HandWiki
Short description: Mathematical problem


Two pence coin
Five pence coin
With only 2 pence and 5 pence coins, one cannot make 3 pence, but one can make any higher integer amount.

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.[1] 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, [math]\displaystyle{ x }[/math] and [math]\displaystyle{ y }[/math]: the Frobenius number is then [math]\displaystyle{ 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 for computing the Frobenius number in polynomial time (in the logarithms of the coin denominations forming an input).[2] 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.[3][4]

Statement

In mathematical terms, the problem can be stated:

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

This largest integer is called the Frobenius number of the set [math]\displaystyle{ \{a_1,a_2,\dots,a_n\} }[/math], and is usually denoted by [math]\displaystyle{ 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; 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 [math]\displaystyle{ \{a_1,a_2,\dots,a_n\} }[/math] 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.[4]

n = 1

If [math]\displaystyle{ n=1 }[/math], then we must have [math]\displaystyle{ a_1=1 }[/math] so that all natural numbers can be formed.

n = 2

If [math]\displaystyle{ n=2 }[/math], the Frobenius number can be found from the formula [math]\displaystyle{ g(a_1, a_2) = a_1a_2-a_1-a_2 }[/math], which was discovered by James Joseph Sylvester in 1882.[5][nb 1] Sylvester also demonstrated for this case that there are a total of [math]\displaystyle{ N(a_1, a_2) = (a_1-1)(a_2-1)/2 }[/math] non-representable (positive) integers.

Another form of the equation for [math]\displaystyle{ g(a_1, a_2) }[/math] is given by Skupień[8] in this proposition: If [math]\displaystyle{ a_1,a_2 \in \mathbb{N} }[/math] and [math]\displaystyle{ \gcd(a_1, a_2) = 1 }[/math] then, for each [math]\displaystyle{ n \ge (a_1-1)(a_2-1) }[/math], there is exactly one pair of nonnegative integers [math]\displaystyle{ \rho }[/math] and [math]\displaystyle{ \sigma }[/math] such that [math]\displaystyle{ \sigma \lt a_1 }[/math] and [math]\displaystyle{ n = \rho a_1 +\sigma a_2 }[/math].

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

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

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

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

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

n = 3

Formulae[9] and fast algorithms[10] 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]\displaystyle{ 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.[11] ([math]\displaystyle{ f }[/math] here is the modified Frobenius number, which is the greatest integer not representable by positive integer linear combinations of [math]\displaystyle{ a_1, a_2, a_3 }[/math].) Comparison with the actual limit (defined by the parametric relationship, [math]\displaystyle{ f(z(i)) = 9i^2 + 54i + 79 }[/math] where [math]\displaystyle{ z(i) = a_1 a_2 a_3 = (3i + 7)(3i + 10)(3i^2 + 19i + 29) }[/math]) shows that the approximation is only 1 less than the true value as [math]\displaystyle{ i \rightarrow \infty }[/math]. It is conjectured that a similar parametric upper bound (for values of [math]\displaystyle{ a_1, a_2, a_3 }[/math] that are pairwise-coprime and no element is representable by the others) is [math]\displaystyle{ f(z(i)) = 6i^2 + 19i + 13 }[/math] where [math]\displaystyle{ z(i) = a_1 a_2 a_3 = (3i + 2)(3i + 3)(6i + 7) }[/math].

The asymptotic average behaviour of [math]\displaystyle{ f }[/math] for three variables is also known as:[12]

[math]\displaystyle{ 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]\displaystyle{ a_1\lt a_2\lt ...\lt a_d }[/math], and their Frobenius number [math]\displaystyle{ F }[/math], we have

[math]\displaystyle{ d\geq\frac{F+1}{F+1-g}, }[/math]

where [math]\displaystyle{ g }[/math] denotes the number of all non-representable positive integers.[13] In 2015, an asymptotic version of this was proven by Moscariello and Sammartano.[14]

Frobenius numbers for special sets

Arithmetic sequences

A simple formula exists for the Frobenius number of a set of integers in an arithmetic sequence.[15] Given integers a, d, w with gcd(ad) = 1:

[math]\displaystyle{ 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]\displaystyle{ n=2 }[/math] case above may be expressed as a special case of this formula.

In the event that [math]\displaystyle{ a \gt w^2-3w+1 }[/math], we can omit any subset of the elements [math]\displaystyle{ a+2d, a+3d, ..., a+(w-3)d, a+(w-2)d }[/math] from our arithmetic seq,e and the formula for the Frobenius number remains the same.[16]

Geometric sequences

There also exists a closed form solution for the Frobenius number of a set in a geometric sequence.[17] Given integers m, n, k with gcd(mn) = 1:

[math]\displaystyle{ 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]\displaystyle{ a,b,k }[/math], with [math]\displaystyle{ \gcd(a,b)=1, }[/math] let [math]\displaystyle{ A_k(a,b) = \{a^k, a^{k-1}b, \ldots, b^k\} }[/math]. Then [18]
[math]\displaystyle{ g(A_k(a,b))={\sigma}_{k+1}(a,b) - {\sigma}_k(a,b) - (a^{k+1} + b^{k+1}), }[/math]
where [math]\displaystyle{ {\sigma}_k(a,b) }[/math] denotes the sum of all integers in [math]\displaystyle{ A_k(a,b). }[/math]

Examples

McNugget numbers

A box of 20 McDonald's 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 Games Magazine in 1987,[19] and included it in his algebra textbook co-authored with Anita Wah.[20] 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 Chicken McNuggets in any number of boxes. In the United Kingdom , the original boxes (prior to the introduction of the Happy Meal–sized nugget boxes) were of 6, 9, and 20 nuggets.

According to Schur's theorem, since 6, 9, and 20 are (setwise) relatively prime, 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 (sequence A065003 in the OEIS).
Total 0 1 2 3 4 5
+0 0:0,0,0 1: — 2: — 3: — 4: — 5: —
+6 6:1,0,0 7: — 8: — 9:0,1,0 10: — 11: —
+12 12:2,0,0 13: — 14: — 15:1,1,0 16: — 17: —
+18 18:3,0,0 19: — 20:0,0,1 21:2,1,0 22: — 23: —
+24 24:4,0,0 25: — 26:1,0,1 27:3,1,0 28: — 29:0,1,1
+30 30:5,0,0 31: — 32:2,0,1 33:4,1,0 34: — 35:1,1,1
+36 36:6,0,0 37: — 38:3,0,1 39:5,1,0 40:0,0,2 41:2,1,1
+42 42:7,0,0 43: — 44:4,0,1 45:6,1,0 46:1,0,2 47:3,1,1
+48 48:8,0,0 49:0,1,2 50:5,0,1 51:7,1,0 52:2,0,2 53:4,1,1
+54 54:9,0,0 55:1,1,2 56:6,0,1 57:8,1,0 58:3,0,2 59:5,1,1
A possible set of combinations of boxes for a total of 0 to 59 nuggets.
Each triplet denotes the number of boxes of 6, 9 and 20, respectively.

Thus the largest non–McNugget number is 43.[21] The fact that any integer larger than 43 is a McNugget number can be seen by considering the following integer partitions

[math]\displaystyle{ 44 = 6 + 6 + 6 + 6 + 20 }[/math]
[math]\displaystyle{ 45 = 9 + 9 + 9 + 9 + 9 }[/math]
[math]\displaystyle{ 46 = 6 + 20 + 20 }[/math]
[math]\displaystyle{ 47 = 9 + 9 + 9 + 20 }[/math]
[math]\displaystyle{ 48 = 6 + 6 + 9 + 9 + 9 + 9 }[/math]
[math]\displaystyle{ 49 = 9 + 20 + 20 }[/math]

Any larger integer can be obtained by adding some number of 6s to the appropriate partition above.

Alternatively, since [math]\displaystyle{ \textrm{lcm}(9, 20) = 180 }[/math] and [math]\displaystyle{ 6|180 }[/math], the solution can also be obtained by applying a formula presented for [math]\displaystyle{ n=3 }[/math] earlier:[dubious ]

[math]\displaystyle{ g(6, 9, 20) = \textrm{lcm}(6, 9) + \textrm{lcm}(6, 20) -6 -9 -20 = 18 + 60 -35 = 43 }[/math]

Furthermore, a straightforward check demonstrates that 43 McNuggets can indeed not be purchased, as:

  1. boxes of 6 and 9 alone cannot form 43 as these can only create multiples of 3 (with the exception of 3 itself);
  2. including a single box of 20 does not help, as the required remainder (23) is also not a multiple of 3; and
  3. 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, 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 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.

Similarly, in American football, the only way for a team to score exactly one point is if a safety 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 goals, all scores other than 1–0, 1–1, 2–1, 3–1, 4–1, 5–1 and 7–1 are possible.

Applications

[22]

Shellsort Time Complexity

The Shellsort algorithm is a sorting algorithm whose time complexity is currently an 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 are useful for modeling problems in 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 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]\displaystyle{ x }[/math] greater than the Frobenius number for some exponent (when GCD=1), e.g., for [math]\displaystyle{ (1 + x^6 + x^7)^n }[/math] the set is {6, 7} which has a Frobenius number of 29, so a term with [math]\displaystyle{ x^{29} }[/math] will never appear for any value of [math]\displaystyle{ n }[/math] but some value of [math]\displaystyle{ n }[/math] will give terms having any power of [math]\displaystyle{ 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]\displaystyle{ (1+x^9+x^{15})^n }[/math], powers of 24, 27,... will appear for some value(s) of [math]\displaystyle{ 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

Notes

  1. The original source is sometimes incorrectly cited as,[6] in which the author put his theorem as a recreational problem[7] (and did not explicitly state the formula for the Frobenius number).

References

  1. J. Ramírez Alfonsín (2005). The Diophantine Frobenius problem. Oxford Univ. Press. 
  2. Ravi Kannan (1992). "Lattice translates of a polytope and the Frobenius problem". Combinatorica 12 (2): 161–177. doi:10.1007/BF01204720. 
  3. D. Beihoffer; J. Hendry; A. Nijenhuis; S. Wagon (2005). "Faster algorithms for Frobenius numbers". Electronic Journal of Combinatorics 12: R27. doi:10.37236/1924. http://www.combinatorics.org/Volume_12/Abstracts/v12i1r27.html. 
  4. 4.0 4.1 Weisstein, Eric W.. "Coin Problem". http://mathworld.wolfram.com/CoinProblem.html. 
  5. Sylvester, James Joseph (1882). "On subinvariants, i.e. Semi-Invariants to Binary Quantics of an Unlimited Order". American Journal of Mathematics 5 (1): 134. doi:10.2307/2369536. 
  6. Sylvester, James Joseph (1884). "Question 7382". Mathematical Questions from the Educational Times 41: 21. https://archive.org/stream/mathematicalque05unkngoog#page/n150. 
  7. J. Ramírez Alfonsín (2005). The Diophantine Frobenius problem. Oxford Univ. Press. p. xiii. 
  8. Skupień, Zdzisław (1993). "A generalization of Sylvester's and Frobenius' problems". Acta Arithmetica LXV.4 (4): 353–366. doi:10.4064/aa-65-4-353-366. http://matwbn.icm.edu.pl/ksiazki/aa/aa65/aa6545.pdf. 
  9. Tripathi, A. (2017). "Formulae for the Frobenius number in three variables". Journal of Number Theory 170: 368–389. doi:10.1016/j.jnt.2016.05.027. 
  10. See numerical semigroup for details of one such algorithm.
  11. M. Beck; S. Zacks (2004). "Refined upper bounds for the linear Diophantine problem of Frobenius". Adv. Appl. Math. 32 (3): 454–467. doi:10.1016/S0196-8858(03)00055-1. 
  12. Ustinov, A. (2009). "The solution of Arnold's problem on the weak asymptotics of Frobenius numbers with three arguments". Sbornik: Mathematics 200 (4): 131–160. doi:10.1070/SM2009v200n04ABEH004011. Bibcode2009SbMat.200..597U. 
  13. Wilf, H.S. (1978). "A Circle-Of-Lights Algorithm for the "Money-Changing Problem"". The American Mathematical Monthly 85 (7): 562-565. https://www.jstor.org/stable/2320864. 
  14. Moscariello, A. & Sammartano, A. (2015). "On a Conjecture by Wilf About the Frobenius Number". Mathematische Zeitschrift 280: 47-53. doi:10.1007/s00209-015-1412-0. 
  15. Ramirez Alfonsin, Jorge (2005). The Diophantine Frobenius Problem. Oxford University Press. pp. 59–60. 
  16. Lee, S.H.; O'neill, C.; Van Over, B. (2019). "On arithmetical numerical monoids with some generators omitted". Semigroup Forum 98 (2): 315–326. doi:10.1007/s00233-018-9952-3. 
  17. Ong, Darren C.; Ponomarenko, Vadim (2008). "The Frobenius Number of Geometric Sequences". INTEGERS: The Electronic Journal of Combinatorial Number Theory 8 (1): A33. http://www.emis.de/journals/INTEGERS/papers/i33/i33.Abstract.html. Retrieved 2010-01-04. 
  18. Tripathi, Amitabha (2008). "On the Frobenius Problem for Geometric Sequences, Article A43". INTEGERS: The Electronic Journal of Combinatorial Number Theory 8 (1). 
  19. Picciotto, Henri (1987). "Math McPuzzle". Games Magazine 85 (April/May): 52. https://archive.org/details/games-85-1987-april/page/n53/mode/2up. 
  20. Wah, Anita; Picciotto, Henri (1994). "Lesson 5.8 Building-block Numbers". Algebra: Themes, Tools, Concepts. p. 186. http://www.mathedpage.org/attc/lessons/ch.05/5.08-building-blocks.pdf. 
  21. Weisstein, Eric W.. "McNugget Number". http://mathworld.wolfram.com/McNuggetNumber.html. 
  22. J. Ramírez Alfonsín (2005). The Diophantine Frobenius problem. Oxford Univ. Press. pp. 132–135. 

Further reading

  • Tuenter, Hans J. H. (April 2006). "The Frobenius problem, sums of powers of integers, and recurrences for the Bernoulli numbers". Journal of Number Theory 117 (2): 376-386. doi:10.1016/j.jnt.2005.06.015. 

External links