Checking an integer-combination target with a GCD
Every sum of integer multiples of two numbers is divisible by their greatest common divisor, so a target that fails that test cannot be built. This guide tests 15 and 16 against the numbers 6 and 10.
The divisibility fact
Take two integers, a and b, and any whole-number multipliers x and y, which may be positive, zero or negative. The combination a times x plus b times y is a sum of multiples of a and b. If a number d divides both a and b, it divides each of the two products and therefore their sum. The greatest common divisor is the largest such d. So every integer combination is divisible by the GCD. The converse is also true, a result known as Bezout's identity: the GCD itself can be written as such a combination, and so can every multiple of it. The worksheet uses the first half as a screening test.
Computing the GCD of 6 and 10
The divisors of 6 are 1, 2, 3 and 6, and the divisors of 10 are 1, 2, 5 and 10. The largest one they share is 2. The Euclidean algorithm gets there another way: 10 divided by 6 leaves remainder 4, then 6 divided by 4 leaves 2, then 4 divided by 2 leaves 0, so the last nonzero remainder, 2, is the GCD. The GCD calculator returns 2 for 6 and 10, as the first case records. This means every integer combination of 6 and 10 is even, no matter which multipliers are chosen. The divisor is a property of the pair, found before searching for any multipliers.
Why 15 is impossible
The number 15 is odd, and every integer combination of 6 and 10 is even. Both 6 and 10 are even, so the sum of any multiples of them is even. No choice of x and y can make 6x plus 10y equal 15. The conclusion comes from one divisibility check, with no search through possible multipliers. This is the useful side of the test: it can prove that no solution exists. The test is a necessary condition, meaning a target that fails it is out, though a target that passes is not yet guaranteed. For passing targets, a solution exists with integer multipliers, as the next section shows.
Why 16 passes
The number 16 is even and so is divisible by the GCD of 2. A solution exists: 6 plus 10 equals 16, using multipliers of 1 and 1. The second case below adds 6 and 10 and gets 16. Other solutions exist as well. With multipliers of 6 and negative 2, 36 minus 20 also gives 16. Whenever one integer solution exists, infinitely many do, obtained by adding 5 to x and subtracting 3 from y, since 6 times 5 equals 10 times 3. The last reference case multiplies 2 by 7 to get 14, another multiple of the GCD, and 14 is reachable too, as 6 times 4 minus 10 times 1. The test therefore sorts targets into two groups: multiples of 2, which can be built, and everything else, which cannot.
Integer coefficients versus nonnegative counts
Passing the GCD test guarantees a solution with integer multipliers, which may be negative. It does not guarantee one with only nonnegative multipliers. For 6 and 10, the target 2 is a multiple of the GCD, and 2 equals 6 times 2 minus 10 times 1, but it has no solution using only nonnegative multipliers, since the smallest positive combination with nonnegative coefficients is 6. Restrictions on the multipliers turn the question into a different problem. The worksheet addresses only the divisibility test, and anything that requires nonnegative counts needs further reasoning.
Coprime numbers and the largest unreachable target
When the GCD is 1, every integer can be written as an integer combination, but the nonnegative case still has gaps. For 3 and 5, the GCD is 1. The targets 1, 2, 4 and 7 cannot be made from nonnegative multiples of 3 and 5, while 3, 5, 6, 8, 9 and 10 can, and every integer from 8 upward can. The largest unreachable number is 7, which equals 3 times 5 minus 3 minus 5. This result for two coprime numbers is attributed to James Joseph Sylvester, and it belongs to the family of Frobenius coin problems.
Another pair with a larger GCD
Consider 12 and 18. Their divisors in common are 1, 2, 3 and 6, so the GCD is 6. Every combination of 12 and 18 is a multiple of 6. The targets 30, 42 and 6 are possible with integer multipliers, while 20 and 15 are not, because neither is divisible by 6. For 4 and 6, the GCD is 2, so the odd targets are all ruled out. A larger GCD removes a larger share of the integers: a GCD of g leaves only one target in every g consecutive integers. This explains why numbers with large common factors reach so few targets.
Reading the problem correctly
The mathematics concerns exact integer combinations. Real situations such as packages, tiles or coins add further conditions: multipliers cannot be negative, and sometimes there are limits on how many of each item can be used. The worksheet does not recommend package sizes or purchases. It only shows how a divisibility test settles one kind of question quickly. If the test fails, no amount of searching will help. If it passes, the problem moves to the question of what other restrictions apply, and that question needs its own count.
Using the GCD calculator as a screening step
To apply the test to your own numbers, compute the GCD of the two sizes, divide the target by it, and look at the remainder. A remainder of zero means the target passes. Any other remainder means no integer combination reaches it. For the target 15 with sizes 6 and 10, 15 divided by 2 leaves 1, so the target fails. For 16, the remainder is 0 and the target passes. The calculation takes seconds and spares a long search in the failing case. To find actual multipliers for a passing target, the extended Euclidean algorithm produces a pair for the GCD itself, which is then scaled up: for 6 and 10, 6 times 2 minus 10 times 1 equals 2, and multiplying both multipliers by 8 gives 16. That route works for large numbers where guessing would not. The GCD test also extends to more than two numbers: the GCD of 6, 10 and 15 is 1, so combinations of all three can reach any integer, even though each pair shares a divisor larger than 1.
Reproduce the checks
Common divisor
Open the GCD calculator and enter:
- First integer
6- Second integer
10
Expected output:
Greatest common divisor
2Every integer combination retains this divisor.
A feasible even target
Open the Basic calculator and enter:
- First number
6- Operation
add- Second number
10
Expected output:
Result
16One nonnegative combination reaches sixteen.
Parity reference
Open the Basic calculator and enter:
- First number
2- Operation
multiply- Second number
7
Expected output:
Result
14The next odd target fifteen cannot be a multiple of two.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.