Pick two whole numbers a and b that share no common factor bigger than 1. Using copies of a and copies of b — as many of each as you like — which totals c = x·a + y·b can you build? We show two things: every number bigger than ab can be built, and the number ab − a − b never can.
Let a and b be positive whole numbers that share no common factor bigger than 1.
Part 1. Every whole number c > ab can be built as c = x·a + y·b, using whole-number counts x, y ≥ 0.
Part 2. The number ab − a − b cannot be built this way.
Play with the sliders above and the picture is always the same: a scatter of orange numbers you can't build, then a sharp cutoff, then solid blue (buildable) forever. The proof explains both why the cutoff exists (Part 1) and exactly where it sits (Part 2).
Here's a standard fact about two numbers that share no common factor: you can always combine them to land on exactly 1, using whole-number multipliers u and v (usually one of them is negative). Written out:
Now multiply both sides by c. That scales the combination up from 1 to c:
So there is always some way to hit c with whole numbers. The catch: because u or v was negative, x0 or y0 can come out negative too — and a negative count doesn't correspond to actually building c. The whole job now is to turn this into a solution where both counts are ≥ 0.
Say we have two solutions, x·a + y·b = c and x0·a + y0·b = c. Subtract one from the other:
The right side is a multiple of b, so the left side is a multiple of b too. But a shares no common factor with b, so a can't supply any part of that multiple of b — it has to come entirely from (x − x0). In other words, (x − x0) is itself a multiple of b. Write it as t·b; putting that back in gives (y0 − y) = t·a. So every solution looks like
and every choice of t really is a solution. So the solutions form a ladder: pick any one, then step t up or down. Each step adds b to x and subtracts a from y — and the total never changes, since (+b)·a + (−a)·b = 0.
How to read this picture:
Now drag c. While c is small, the circled dot sits below the shaded region — its y is negative, so c can't be built. As c grows past ab, the circled dot rises into the shaded region and c becomes buildable. That single moment is Part 1.
Stepping along the ladder shifts x by b each time, so exactly one rung lands in the strip
Pick that one. It already has x ≥ 0. We just need to check its y is also ≥ 0. Rearrange the equation to y·b = c − x·a. Since x is at most b − 1, we subtract at most (b − 1)a; and we're told c > ab. Chaining those:
So y·b is positive, and since b is positive, y is positive too. Both counts are ≥ 0, so we have genuinely built c = x·a + y·b.
Suppose the opposite of what we want to prove: that you can build it, say ab − a − b = x·a + y·b with counts x, y ≥ 0. Add a and b to both sides and group the terms:
This rearrangement is the whole trick. The two multipliers x + 1 and y + 1 are now both at least 1 (because x, y ≥ 0) — keep that in mind.
Look at both sides of ab = (x + 1)·a + (y + 1)·b and ask for their remainder after dividing by a:
But a shares no common factor with b, so the factor of a can't come from b — it must come from (y + 1). So a divides (y + 1). And y + 1 is at least 1, so it is a positive multiple of a, which forces y + 1 ≥ a.
Running the exact same argument, but dividing by b instead, gives the mirror result: x + 1 ≥ b.
Put those two facts — x + 1 ≥ b and y + 1 ≥ a — back into ab = (x + 1)·a + (y + 1)·b:
So ab ≥ 2ab, which means ab ≤ 0 — impossible, since a and b are positive. Our supposition was wrong, so ab − a − b can't be built.
Here is the same number line, folded into columns: each column collects the numbers that leave the same remainder when divided by a. Moving up one cell adds a. So the moment a column contains any number you can build, everything above it in that column can be built too — just add another a.
What is the lowest buildable number in each column — the "key" that unlocks it? The multiples of b: 0, b, 2b, …, (a−1)b. Because a and b share no common factor, these a multiples all leave different remainders when divided by a — so they land in a different columns, one key per column.
Now both halves of the theorem are visible at once. The last column to unlock is the one opened by the biggest key, (a − 1)·b = ab − b. The cell one step (one a) below that key is
the highest number you can't build anywhere on the board — exactly the number Part 2 ruled out. And every number above ab − b sits above its column's key, so it can be built; in particular everything past ab can, which is Part 1 again, with room to spare.