Frobenius Coin Problem Calculator
Denominations
Test
- For two coprime denominations the Frobenius number is a x b - a - b: with coins of 7 and 11 the largest amount that cannot be formed is 7 x 11 - 7 - 11 = 59.
- Exactly half of the amounts below it fail: (a - 1)(b - 1) / 2 = 30 positive amounts cannot be made.
- The test amount 100 is checked by solving a x + b y = 100 in non-negative integers: it is formable as 7 x 8 + 11 x 4.
- Every amount above the Frobenius number is formable - this is Sylvester's 1884 result, famous as the Chicken McNugget problem for packs of 6, 9 and 20.
The Frobenius Coin Problem Calculator finds the largest amount that cannot be formed from two coprime denominations a and b, and counts how many positive amounts are impossible. For two coprime denominations, the largest unformable amount is ab - a - b, known as the Chicken McNugget theorem, and the number of positive amounts that cannot be formed is (a - 1)(b - 1) / 2, exactly half of the amounts up to the Frobenius number. For coins of 7 and 11, the calculator reports a largest impossible amount of 59 and 30 impossible amounts. For coins of 4 and 9, it gives 23 as the largest impossible amount with 12 impossible amounts, and shows that the test amount 50 is formable as 4 x 8 + 9 x 2. If the denominations share a factor, such as 6 and 10 with gcd 2, there is no largest impossible amount, because every amount not divisible by 2 fails.
This method is the accepted standard for the two-denomination case because it rests on a proved result: every amount above the Frobenius number is representable, a result proved by Sylvester in 1884. That guarantee is why the formula gives the exact largest impossible amount rather than an estimate. This page shows the formula, step-by-step workings, worked examples and sources so you can follow each calculation and check the result yourself.
Worked examples
Coins of 7 and 11
(7 · 11 · 100)
| Largest non-representable amount | 59 |
| Non-representable amounts in total | 30 |
| Is 100 representable? | Yes - 7 x 8 + 11 x 4 |
| gcd(a, b) | 1 (coprime) |
| Chicken McNugget theorem | largest = a x b - a - b |
Coins of 4 and 9
(4 · 9 · 50)
| Largest non-representable amount | 23 |
| Non-representable amounts in total | 12 |
| Is 50 representable? | Yes - 4 x 8 + 9 x 2 |
| gcd(a, b) | 1 (coprime) |
| Chicken McNugget theorem | largest = a x b - a - b |
Non-coprime coins 6 and 10
(6 · 10 · 30)
| Largest non-representable amount | None - infinitely many |
| gcd(a, b) | 2 (not coprime) |
| Non-representable amounts in total | Infinite |
| Is 30 representable? | Only amounts divisible by 2 can ever be formed |
| Chicken McNugget theorem | Requires coprime denominations |
The Chicken McNugget question
The Chicken McNugget question is the friendliest way into the Frobenius coin problem. McDonald's once sold Chicken McNuggets in packs of 6, 9 and 20, and customers noticed that some order sizes were simply impossible to fill exactly with those pack sizes. You could buy 15 nuggets as 6 + 9, or 20 as a single pack, but certain smaller totals could not be assembled from any combination of 6, 9 and 20. The puzzle became famous enough that the underlying mathematics now carries the name. A frobenius coin problem calculator answers exactly this kind of question for whatever denominations you give it, and the McNugget case is the classic example people bring to it.
The three-pack version is genuinely awkward, but the two-denomination case has a complete, tidy answer. When the two denominations a and b share no common factor other than 1, the largest amount that cannot be formed is ab - a - b. This is the Chicken McNugget theorem. It tells you that beyond a certain point, every total is reachable, and it hands you the exact boundary. For coins of 7 and 11, the formula gives 77 - 7 - 11 = 59, so 59 is the largest impossible amount. For coins of 4 and 9, it gives 36 - 4 - 9 = 23, making 23 the last unformable total.
The theorem also counts the failures. The number of positive amounts that cannot be formed is (a - 1)(b - 1) / 2, which is exactly half of the amounts up to the Frobenius number. With 7 and 11, that count is 6 x 10 / 2 = 30 impossible amounts. With 4 and 9, it is 3 x 8 / 2 = 12. The counting rule is a useful check: if a calculator reports a largest impossible amount, the tally of impossible amounts should match this figure. It also makes clear that the gaps are not scattered randomly; they are structured, and the formula captures that structure precisely.
The guarantee that every amount above the Frobenius number is representable is not a modern observation. Sylvester proved it in 1884, which is why the two-denomination result is often attached to his name. That proof is what lets you stop checking: once you pass the boundary, no further failures are possible.
There is one important catch. The clean formulas depend on the denominations being coprime. If they share a factor, as with 6 and 10, whose greatest common divisor is 2, there is no largest impossible amount at all. Every amount not divisible by 2 fails, no matter how large it is, so the list of impossible totals never ends. That is why the two-denomination answer is described as complete only for coprime pairs, and why the three-pack McNugget problem, with 6, 9 and 20, needs more than a single subtraction.
- 7 and 11: largest impossible amount 59, with 30 impossible amounts.
- 4 and 9: largest impossible amount 23, with 12 impossible amounts; the test amount 50 is formable as 4 x 8 + 9 x 2.
- 6 and 10: gcd 2, so there is no largest impossible amount — every amount not divisible by 2 fails.
The two-coin theorem
For two denominations a and b that share no common factor, the Frobenius coin problem has a clean closed form. The largest amount that cannot be formed is ab - a - b, a result known as the Chicken McNugget theorem. Alongside it comes a second formula for counting failures: the number of positive amounts that cannot be formed is (a - 1)(b - 1) / 2. Notice that this is exactly half of the amounts up to the Frobenius number, since there are ab - a - b positive amounts at or below it. A frobenius coin problem calculator applies both formulas together, so you get the boundary and the count in one step.
The count formula is worth reading carefully. Of the amounts from 1 up to ab - a - b, exactly half are impossible and the other half can be formed. The reason is symmetry: the amounts pair up, and in each pair exactly one is representable while the other is not. That pairing is why the number of failures is half the total, and why the two formulas are really two views of the same structure.
Two worked examples make the arithmetic concrete. With coins of 7 and 11, the largest impossible amount is 59, and there are 30 impossible amounts. With coins of 4 and 9, the largest impossible amount is 23 and there are 12 impossible amounts. The second example also shows the other side of the boundary: the test amount 50 is formable as 4 x 8 + 9 x 2. Once you are past 23, every amount can be built, and the calculator can confirm that for any amount you supply.
The formulas depend on a and b being coprime. If the denominations share a factor, as with 6 and 10, whose gcd is 2, there is no largest impossible amount: every amount not divisible by 2 fails, no matter how large it is, so the failure set is infinite and the two formulas do not apply. This is the first thing to check before trusting any result. When the coins are coprime, the guarantee holds: every amount above the Frobenius number is representable, a result proved by Sylvester in 1884.
Testing a specific amount
A frobenius coin problem calculator answers a more concrete question than the name suggests: given two denominations a and b and a target amount t, can t be written as a x + b y with x and y both non-negative integers? That is the whole test. The calculator searches for a pair of non-negative coefficients that satisfies the equation exactly, and if it finds one, it reports the amount as formable along with the combination. If no such pair exists, the amount is impossible for those coins.
Take coins of 4 and 9 and a test amount of 50. The calculator looks for non-negative x and y such that 4x + 9y = 50. One solution is x = 8 and y = 2, since 4 x 8 + 9 x 2 = 32 + 18 = 50. The amount is therefore formable, and the calculator can show that combination. The same check works for any target: the equation is solved in non-negative integers, and the answer is a yes or no with the supporting coefficients when the answer is yes.
The context for those answers comes from the two-coin case. For coprime denominations a and b, the largest amount that cannot be formed is ab - a - b, known as the Chicken McNugget theorem. For coins of 7 and 11 that largest impossible amount is 59, and there are 30 impossible amounts in total. Those 30 are exactly half of the amounts up to the Frobenius number, matching the count (a - 1)(b - 1) / 2. For coins of 4 and 9 the largest impossible amount is 23 with 12 impossible amounts, which is why 50, well above 23, is comfortably formable. Every amount above the Frobenius number is representable, a result proved by Sylvester in 1884, so once a target clears that threshold the test is guaranteed to succeed.
The coprime condition matters. If the denominations share a factor, as with 6 and 10, whose greatest common divisor is 2, there is no largest impossible amount: every amount not divisible by 2 fails no matter how large it is. A target of 51 would fail with 6 and 10 even though it is far beyond any threshold, because the equation 6x + 10y = 51 has no integer solution at all. The calculator should flag that shared factor rather than report a finite Frobenius number.
- Enter the two denominations a and b, then the target amount t.
- The calculator solves a x + b y = t in non-negative integers and reports the coefficients when a solution exists.
- Example: with 4 and 9, the amount 50 is formable as 4 x 8 + 9 x 2.
- If a and b share a factor, amounts not divisible by that factor can never be formed.
When the theorem does not apply
The formulas behind a Frobenius coin problem calculator depend on one condition: the denominations must be coprime, meaning their greatest common divisor is 1. When that condition fails, the usual answers break down. Take coins of 6 and 10. Their gcd is 2, so every amount you can form by combining them is a multiple of 2. Any amount not divisible by 2 — 5, 7, 11, 13, and so on — can never be formed, no matter how many coins you use. Because those failures never stop, there is no largest impossible amount, and the Frobenius number does not exist for this pair. The Chicken McNugget theorem, which gives ab - a - b for two coprime denominations a and b, simply cannot be applied here.
This is why a Frobenius coin problem calculator must check the gcd before it reports a result. For 7 and 11, which share no factor other than 1, the theorem applies: the largest impossible amount is 59, and there are 30 impossible amounts. Those 30 are exactly half of the amounts up to the Frobenius number, matching the count (a - 1)(b - 1) / 2. For 4 and 9, the largest impossible amount is 23 with 12 impossible amounts, and a test amount such as 50 is formable as 4 x 8 + 9 x 2. In each case the guarantee holds: every amount above the Frobenius number is representable, a result proved by Sylvester in 1884. With 6 and 10, that guarantee has nothing to attach to, because the set of unformable amounts is infinite.
Three or more denominations are a different story. There is no general formula comparable to ab - a - b that gives the Frobenius number for an arbitrary set of three or more coprime denominations. Each set has to be handled on its own terms, often by systematic search or by specialized methods that apply only to particular cases. The two-coin theorem is a clean, closed result; the many-coin problem is not, and no single expression covers it.
So when you use the calculator, the gcd test comes first. If the denominations share a common factor, the honest answer is that no largest impossible amount exists, and the tool should say so rather than return a number. If they are coprime and there are two of them, the classic formula applies. If there are three or more coprime denominations, expect a computed answer rather than a one-line formula. Keeping these cases straight is what separates a reliable result from a misleading one.
- 6 and 10 share the factor 2, so every odd amount is impossible and there is no largest impossible amount.
- 7 and 11 are coprime: the largest impossible amount is 59, with 30 impossible amounts.
- 4 and 9 are coprime: the largest impossible amount is 23, with 12 impossible amounts; 50 is formable as 4 x 8 + 9 x 2.
- Three or more denominations have no general formula for the Frobenius number.
FAQs
What is the largest amount that cannot be made with 7 and 11 coins?
The largest impossible amount is 59, which comes from 7 x 11 - 7 - 11. For the pair 7 and 11, exactly 30 positive amounts cannot be made in total. Every amount above 59 can be formed using some combination of 7s and 11s.
Why is it called the Chicken McNugget problem?
McDonald's sold nuggets in packs of 6, 9 and 20. The largest order that cannot be assembled exactly from those pack sizes became the textbook example of the Frobenius number, so the problem took the Chicken McNugget name.
What if my coins are 6 and 10?
Their gcd is 2, so only even amounts can ever be formed, and there is no largest impossible amount. The calculator reports this case explicitly rather than returning a Frobenius number. A largest impossible amount exists only when the two denominations share no common factor greater than 1.
How does the calculator test an amount?
It searches x from 0 upward for a remainder divisible by b, which gives an exact integer solution of a x + b y = t. Finding such a solution means the amount can be formed; if none is found, the amount is impossible.
Does the formula work for three denominations?
No closed form exists for three or more denominations. Computation is still possible case by case, but the elegant ab - a - b is a two-denomination result only. For three or more coin values, the largest impossible amount must be found by other means.
Who proved the two-coin result?
James Joseph Sylvester proved the two-coin result in 1884. The counting result that exactly half the smaller amounts fail is part of the same classical analysis. Together they describe both the largest impossible amount and how many amounts below it cannot be formed.