Structure preview

The hundred-animal problems: a general method and 20 worked solutions

A hundred animals, a hundred coins and three prices: Diophantine equations, gcd and congruences to find every solution, or prove that none exists. Twenty problems with click-to-reveal solutions.

Section: Number theory Updated:
Articles /cento-bestie-20-problemi-metodo-soluzioni
The hundred-animal problems: a general method and 20 worked solutions

35 min

These problems belong to the hundred-animal family: buying a fixed number of animals of three types while spending exactly a given amount. Finding numbers that match the cost is not enough: the counts must be integers, non-negative, and also match the required total. We will develop a procedure that finds every solution or proves that there are none.

The general method, explained step by step

To understand when ax + by = c has integer solutions, how to find Bézout’s identity and how to obtain every solution, read Linear Diophantine equations: theory and example with extended Euclid.

Open the general Diophantine-equation laboratory: enter the three integer coefficients a, b and c and follow the divisions, substitutions and constraints without skipping any steps.

For hundred-animal problems, after eliminating z and clearing denominators, enter A, B and C from Ax + By = C in the laboratory’s a, b and c fields. Then recover z = N - x - y and also check z ≥ 0, or z ≥ 1 if at least one animal of each type is required: the general laboratory only imposes constraints on x and y.

Illustration for the Number theory section
Section: Number theory

1. From a story to two equations

Let N be the total number of animals, S the available sum, a, b, c the three unit prices, and x, y, z the corresponding counts. The order matters: always read a triple (x, y, z) in the same order as the prices.

x + y + z = N
ax + by + cz = S

The first equation gives z = N - x - y. Substitute into the second:
ax + by + c(N - x - y) = S
(a - c)x + (b - c)y = S - cN.

Here is the practical idea: buying all N animals at price c would cost cN. Each animal of the first type adds a - c to that cost, and each animal of the second adds b - c. These increases must cover exactly S - cN.

If fractions appear, multiply the entire equation by the least common multiple of the price denominators and, if needed, the denominator of S. This gives A x + B y = C with integer coefficients, without rounding. Finally, always recover z = N - x - y.

Collection rule: all 20 problems have N = S = 100. Non-negative integer counts are allowed. If we require at least one animal of each type, impose x, y, z ≥ 1 instead: some solutions will be excluded. Do not confuse these two requirements.

2. Gcd, congruences and bounds: the systematic method

  1. Check the budget first. For positive prices, we must have N × min(a,b,c) ≤ S ≤ N × max(a,b,c). Outside that interval the problem is impossible; being inside it does not yet guarantee a solution.
  2. Eliminate z and fractions. Obtain A x + B y = C.
  3. Calculate d = gcd(|A|,|B|). If d does not divide C, no integer pair exists. Otherwise divide by d: A′x + B′y = C′, with coprime coefficients.
  4. Find the residue class of x. For B′ > 0, consider A′x ≡ C′ (mod B′). Two numbers are congruent when they have the same remainder on division by B′. The term B′y disappears because it is a multiple of B′.
  5. Use an inverse or Euclid’s algorithm. Since the coefficients are coprime, the extended Euclidean algorithm finds u, v with A′u + B′v = 1. Multiply the congruence by u to get x ≡ uC′ (mod B′). If the remainder is r, all candidates are x = r + kB′. If B′ = 1, every integer belongs to the same class: the congruence does not restrict x.
  6. Apply the constraints. Calculate y = (C - Ax)/B and z = N - x - y, then impose the required non-negativity or positivity. Parameter bounds, not random trial and error, decide which candidates remain.
  7. Check both equations. For each triple, check the total number of animals and the exact cost. The parameter interval ensures that no other solutions have been missed.

How do we actually find the inverse? If the reduced coefficients are 31 and 7, divide with remainders: 31 = 4 × 7 + 3, then 7 = 2 × 3 + 1. Work backwards, substituting for the remainder 3: 1 = 7 - 2 × 3 = 7 - 2 × (31 - 4 × 7) = 9 × 7 - 2 × 31. Thus -2, or equivalently 5, is an inverse of 31 modulo 7. It is not guessed: it is obtained by working backwards through Euclid’s divisions.

In this collection a > b > c, hence A > B > 0. From Ax + By = C we obtain an initial bound 0 ≤ x ≤ ⌊C/A⌋. The symbol ⌊ ⌋ means rounding down. We must also check z: the reduced cost equation alone does not automatically enforce every constraint.

Want a complete example? Open problem 1’s solution: it shows every step of the hundred-pig problem, from substitution to checking the triple. We keep it hidden with the others so you can try first.

3. The general solution: a family and an interval

When (A,B) ≠ (0,0) and d divides C, the extended Euclidean algorithm finds u, v such that Au + Bv = d. A particular solution is x₀ = u(C/d), y₀ = v(C/d). It does not matter if it is negative: it is a starting point.

All integer pairs, and only those pairs, are:
x = x₀ + (B/d)k
y = y₀ - (A/d)k
z = N - x₀ - y₀ + ((A - B)/d)k
where k is an integer. Varying k traverses the whole family, not just a sample.

Set m = 0 if an absent type is allowed, or m = 1 if all three types are required. Each constraint has the form q + tk ≥ m. If t > 0, it gives k ≥ ⌈(m - q)/t⌉; if t < 0, it gives k ≤ ⌊(m - q)/t⌋. If t = 0, we must already have q ≥ m. The symbol ⌈ ⌉ means rounding up.

Take the largest lower bound and the smallest upper bound. If k_min > k_max, no triple is admissible. Otherwise use every integer from k_min to k_max: there are k_max - k_min + 1 solutions. This general criterion also works when the prices are not listed in order.

Equal prices: do not divide by zero. If B = 0 and A ≠ 0, solve Ax = C: C/A must be an integer at least m. Then distribute N - x between y and z, each at least m. If A = 0 and B ≠ 0, do the same with y fixed. If A = B = 0, all three prices are equal: for C ≠ 0 there are no solutions; for C = 0, every integer triple with x + y + z = N and the required bounds works. In this last case there are two free quantities, not just one parameter.

4. When no solution exists

First obstacle: the gcd. A variant with 100 animals, 100 coins and prices 7/2, 2, 1/2 gives 6x + 3y = 100. The left side is always a multiple of 3; 100 is not. Therefore no integer solution is possible.

Second obstacle: the counts. Consider horses at 15 coins, donkeys at 5 and sheep at 1/2, again with 100 animals and 100 coins. We obtain 29x + 9y = 100. The gcd is 1, so integer pairs exist. However, 2x ≡ 1 (mod 9) implies x ≡ 5 (mod 9), while y ≥ 0 requires 0 ≤ x ≤ 3. No integer in that class lies in the interval: there is no admissible solution.

For example, x = 5 would give y = -5 and z = 100: both equations hold, but buying minus five donkeys makes no sense. The gcd decides existence among integers; the constraints decide existence in the actual problem.

5. The 20 problems: try first, then reveal the solution

In every problem, buy exactly 100 animals and spend exactly 100 coins. Each listed price is for one animal. Find every non-negative triple, in the stated type order; then check which remain if you want at least one of each type. Press “Show solution and method” to open or close an answer: JavaScript is not required.

  1. The hundred pigs

    The three types are boars, sows, piglets. Their unit prices, in the same order, are 10, 5, 1/2 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    10 × x + 5 × y + 1/2 × z = 100

    2. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain 19x + 9y = 100. The gcd is 1; dividing by 1 leaves 19x + 9y = 100.

    20x + 10y + 1z = 200
    20x + 10y + 1(100 - x - y) = 200

    3. Reduce modulo 9: 19x ≡ 100 (mod 9). Bézout’s identity 19 × (1) + 9 × (-2) = 1 shows that (1) is an inverse of 19 modulo 9. Hence x ≡ (1) × 100 ≡ 1 (mod 9). All candidates are x = 1 + 9k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 5. Substituting the family into the other counts gives x = 1 + 9k, y = 9 - 19k, z = 90 + 10k. The constraints become 1 + 9k ≥ 0 → k ≥ 0; 9 - 19k ≥ 0 → k ≤ 0; 90 + 10k ≥ 0 → k ≥ -9. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 1. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    boars (x)sows (y)piglets (z)Total animalsCost check
    19901001 × 10 + 9 × 5 + 90 × 1/2 = 100

    (1, 9, 90)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

  2. The hundred chickens

    The three types are roosters, hens, chicks. Their unit prices, in the same order, are 5, 3, 1/3 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    5 × x + 3 × y + 1/3 × z = 100

    2. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain 14x + 8y = 200. The gcd is 2; dividing by 2 leaves 7x + 4y = 100.

    15x + 9y + 1z = 300
    15x + 9y + 1(100 - x - y) = 300

    3. Reduce modulo 4: 7x ≡ 100 (mod 4). Bézout’s identity 7 × (3) + 4 × (-5) = 1 shows that (3) is an inverse of 7 modulo 4. Hence x ≡ (3) × 100 ≡ 0 (mod 4). All candidates are x = 0 + 4k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 14. Substituting the family into the other counts gives x = 0 + 4k, y = 25 - 7k, z = 75 + 3k. The constraints become 0 + 4k ≥ 0 → k ≥ 0; 25 - 7k ≥ 0 → k ≤ 3; 75 + 3k ≥ 0 → k ≥ -25. Intersecting the three bounds gives 0 ≤ k ≤ 3. The allowed x values are 0, 4, 8, 12. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    roosters (x)hens (y)chicks (z)Total animalsCost check
    025751000 × 5 + 25 × 3 + 75 × 1/3 = 100
    418781004 × 5 + 18 × 3 + 78 × 1/3 = 100
    811811008 × 5 + 11 × 3 + 81 × 1/3 = 100
    1248410012 × 5 + 4 × 3 + 84 × 1/3 = 100

    (0, 25, 75); (4, 18, 78); (8, 11, 81); (12, 4, 84)

    There are 4 non-negative solutions. If we require at least one animal of each type, 3 remain.

    Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.

  3. Cows, sheep, goats

    The three types are cows, sheep, goats. Their unit prices, in the same order, are 10, 3, 1/2 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    10 × x + 3 × y + 1/2 × z = 100

    2. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain 19x + 5y = 100. The gcd is 1; dividing by 1 leaves 19x + 5y = 100.

    20x + 6y + 1z = 200
    20x + 6y + 1(100 - x - y) = 200

    3. Reduce modulo 5: 19x ≡ 100 (mod 5). Bézout’s identity 19 × (4) + 5 × (-15) = 1 shows that (4) is an inverse of 19 modulo 5. Hence x ≡ (4) × 100 ≡ 0 (mod 5). All candidates are x = 0 + 5k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 5. Substituting the family into the other counts gives x = 0 + 5k, y = 20 - 19k, z = 80 + 14k. The constraints become 0 + 5k ≥ 0 → k ≥ 0; 20 - 19k ≥ 0 → k ≤ 1; 80 + 14k ≥ 0 → k ≥ -5. Intersecting the three bounds gives 0 ≤ k ≤ 1. The allowed x values are 0, 5. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    cows (x)sheep (y)goats (z)Total animalsCost check
    020801000 × 10 + 20 × 3 + 80 × 1/2 = 100
    51941005 × 10 + 1 × 3 + 94 × 1/2 = 100

    (0, 20, 80); (5, 1, 94)

    There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.

    Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.

  4. Peacocks, pigeons, sparrows

    The three types are peacocks, pigeons, sparrows. Their unit prices, in the same order, are 8, 2, 1/4 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    8 × x + 2 × y + 1/4 × z = 100

    2. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain 31x + 7y = 300. The gcd is 1; dividing by 1 leaves 31x + 7y = 300.

    32x + 8y + 1z = 400
    32x + 8y + 1(100 - x - y) = 400

    3. Reduce modulo 7: 31x ≡ 300 (mod 7). Bézout’s identity 31 × (5) + 7 × (-22) = 1 shows that (5) is an inverse of 31 modulo 7. Hence x ≡ (5) × 300 ≡ 2 (mod 7). All candidates are x = 2 + 7k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 9. Substituting the family into the other counts gives x = 2 + 7k, y = 34 - 31k, z = 64 + 24k. The constraints become 2 + 7k ≥ 0 → k ≥ 0; 34 - 31k ≥ 0 → k ≤ 1; 64 + 24k ≥ 0 → k ≥ -2. Intersecting the three bounds gives 0 ≤ k ≤ 1. The allowed x values are 2, 9. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    peacocks (x)pigeons (y)sparrows (z)Total animalsCost check
    234641002 × 8 + 34 × 2 + 64 × 1/4 = 100
    93881009 × 8 + 3 × 2 + 88 × 1/4 = 100

    (2, 34, 64); (9, 3, 88)

    There are 2 non-negative solutions. If we require at least one animal of each type, 2 remain.

  5. Tuna, sea bream, sardines

    The three types are tuna, sea bream, sardines. Their unit prices, in the same order, are 12, 4, 1/2 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    12 × x + 4 × y + 1/2 × z = 100

    2. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain 23x + 7y = 100. The gcd is 1; dividing by 1 leaves 23x + 7y = 100.

    24x + 8y + 1z = 200
    24x + 8y + 1(100 - x - y) = 200

    3. Reduce modulo 7: 23x ≡ 100 (mod 7). Bézout’s identity 23 × (4) + 7 × (-13) = 1 shows that (4) is an inverse of 23 modulo 7. Hence x ≡ (4) × 100 ≡ 1 (mod 7). All candidates are x = 1 + 7k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 4. Substituting the family into the other counts gives x = 1 + 7k, y = 11 - 23k, z = 88 + 16k. The constraints become 1 + 7k ≥ 0 → k ≥ 0; 11 - 23k ≥ 0 → k ≤ 0; 88 + 16k ≥ 0 → k ≥ -5. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 1. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    tuna (x)sea bream (y)sardines (z)Total animalsCost check
    111881001 × 12 + 11 × 4 + 88 × 1/2 = 100

    (1, 11, 88)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

  6. Horses, donkeys, lambs

    The three types are horses, donkeys, lambs. Their unit prices, in the same order, are 4, 3, 1/4 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    4 × x + 3 × y + 1/4 × z = 100

    2. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain 15x + 11y = 300. The gcd is 1; dividing by 1 leaves 15x + 11y = 300.

    16x + 12y + 1z = 400
    16x + 12y + 1(100 - x - y) = 400

    3. Reduce modulo 11: 15x ≡ 300 (mod 11). Bézout’s identity 15 × (3) + 11 × (-4) = 1 shows that (3) is an inverse of 15 modulo 11. Hence x ≡ (3) × 300 ≡ 9 (mod 11). All candidates are x = 9 + 11k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 20. Substituting the family into the other counts gives x = 9 + 11k, y = 15 - 15k, z = 76 + 4k. The constraints become 9 + 11k ≥ 0 → k ≥ 0; 15 - 15k ≥ 0 → k ≤ 1; 76 + 4k ≥ 0 → k ≥ -19. Intersecting the three bounds gives 0 ≤ k ≤ 1. The allowed x values are 9, 20. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    horses (x)donkeys (y)lambs (z)Total animalsCost check
    915761009 × 4 + 15 × 3 + 76 × 1/4 = 100
    2008010020 × 4 + 0 × 3 + 80 × 1/4 = 100

    (9, 15, 76); (20, 0, 80)

    There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.

    Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.

  7. Oxen, goats, chicks

    The three types are oxen, goats, chicks. Their unit prices, in the same order, are 7, 2, 1/2 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    7 × x + 2 × y + 1/2 × z = 100

    2. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain 13x + 3y = 100. The gcd is 1; dividing by 1 leaves 13x + 3y = 100.

    14x + 4y + 1z = 200
    14x + 4y + 1(100 - x - y) = 200

    3. Reduce modulo 3: 13x ≡ 100 (mod 3). Bézout’s identity 13 × (1) + 3 × (-4) = 1 shows that (1) is an inverse of 13 modulo 3. Hence x ≡ (1) × 100 ≡ 1 (mod 3). All candidates are x = 1 + 3k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 7. Substituting the family into the other counts gives x = 1 + 3k, y = 29 - 13k, z = 70 + 10k. The constraints become 1 + 3k ≥ 0 → k ≥ 0; 29 - 13k ≥ 0 → k ≤ 2; 70 + 10k ≥ 0 → k ≥ -7. Intersecting the three bounds gives 0 ≤ k ≤ 2. The allowed x values are 1, 4, 7. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    oxen (x)goats (y)chicks (z)Total animalsCost check
    129701001 × 7 + 29 × 2 + 70 × 1/2 = 100
    416801004 × 7 + 16 × 2 + 80 × 1/2 = 100
    73901007 × 7 + 3 × 2 + 90 × 1/2 = 100

    (1, 29, 70); (4, 16, 80); (7, 3, 90)

    There are 3 non-negative solutions. If we require at least one animal of each type, 3 remain.

  8. Deer, hares, rabbits

    The three types are deer, hares, rabbits. Their unit prices, in the same order, are 8, 6, 1/2 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    8 × x + 6 × y + 1/2 × z = 100

    2. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain 15x + 11y = 100. The gcd is 1; dividing by 1 leaves 15x + 11y = 100.

    16x + 12y + 1z = 200
    16x + 12y + 1(100 - x - y) = 200

    3. Reduce modulo 11: 15x ≡ 100 (mod 11). Bézout’s identity 15 × (3) + 11 × (-4) = 1 shows that (3) is an inverse of 15 modulo 11. Hence x ≡ (3) × 100 ≡ 3 (mod 11). All candidates are x = 3 + 11k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 6. Substituting the family into the other counts gives x = 3 + 11k, y = 5 - 15k, z = 92 + 4k. The constraints become 3 + 11k ≥ 0 → k ≥ 0; 5 - 15k ≥ 0 → k ≤ 0; 92 + 4k ≥ 0 → k ≥ -23. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 3. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    deer (x)hares (y)rabbits (z)Total animalsCost check
    35921003 × 8 + 5 × 6 + 92 × 1/2 = 100

    (3, 5, 92)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

  9. Geese, ducks, chicks

    The three types are geese, ducks, chicks. Their unit prices, in the same order, are 10, 4, 1/3 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    10 × x + 4 × y + 1/3 × z = 100

    2. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain 29x + 11y = 200. The gcd is 1; dividing by 1 leaves 29x + 11y = 200.

    30x + 12y + 1z = 300
    30x + 12y + 1(100 - x - y) = 300

    3. Reduce modulo 11: 29x ≡ 200 (mod 11). Bézout’s identity 29 × (8) + 11 × (-21) = 1 shows that (8) is an inverse of 29 modulo 11. Hence x ≡ (8) × 200 ≡ 5 (mod 11). All candidates are x = 5 + 11k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 6. Substituting the family into the other counts gives x = 5 + 11k, y = 5 - 29k, z = 90 + 18k. The constraints become 5 + 11k ≥ 0 → k ≥ 0; 5 - 29k ≥ 0 → k ≤ 0; 90 + 18k ≥ 0 → k ≥ -5. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 5. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    geese (x)ducks (y)chicks (z)Total animalsCost check
    55901005 × 10 + 5 × 4 + 90 × 1/3 = 100

    (5, 5, 90)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

  10. Peacocks, hens, sparrows

    The three types are peacocks, hens, sparrows. Their unit prices, in the same order, are 15, 4, 1/2 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    15 × x + 4 × y + 1/2 × z = 100

    2. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain 29x + 7y = 100. The gcd is 1; dividing by 1 leaves 29x + 7y = 100.

    30x + 8y + 1z = 200
    30x + 8y + 1(100 - x - y) = 200

    3. Reduce modulo 7: 29x ≡ 100 (mod 7). Bézout’s identity 29 × (1) + 7 × (-4) = 1 shows that (1) is an inverse of 29 modulo 7. Hence x ≡ (1) × 100 ≡ 2 (mod 7). All candidates are x = 2 + 7k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 3. Substituting the family into the other counts gives x = 2 + 7k, y = 6 - 29k, z = 92 + 22k. The constraints become 2 + 7k ≥ 0 → k ≥ 0; 6 - 29k ≥ 0 → k ≤ 0; 92 + 22k ≥ 0 → k ≥ -4. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 2. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    peacocks (x)hens (y)sparrows (z)Total animalsCost check
    26921002 × 15 + 6 × 4 + 92 × 1/2 = 100

    (2, 6, 92)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

  11. Horses, sheep, lambs

    The three types are horses, sheep, lambs. Their unit prices, in the same order, are 6, 3, 1/2 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    6 × x + 3 × y + 1/2 × z = 100

    2. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain 11x + 5y = 100. The gcd is 1; dividing by 1 leaves 11x + 5y = 100.

    12x + 6y + 1z = 200
    12x + 6y + 1(100 - x - y) = 200

    3. Reduce modulo 5: 11x ≡ 100 (mod 5). Bézout’s identity 11 × (1) + 5 × (-2) = 1 shows that (1) is an inverse of 11 modulo 5. Hence x ≡ (1) × 100 ≡ 0 (mod 5). All candidates are x = 0 + 5k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 9. Substituting the family into the other counts gives x = 0 + 5k, y = 20 - 11k, z = 80 + 6k. The constraints become 0 + 5k ≥ 0 → k ≥ 0; 20 - 11k ≥ 0 → k ≤ 1; 80 + 6k ≥ 0 → k ≥ -13. Intersecting the three bounds gives 0 ≤ k ≤ 1. The allowed x values are 0, 5. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    horses (x)sheep (y)lambs (z)Total animalsCost check
    020801000 × 6 + 20 × 3 + 80 × 1/2 = 100
    59861005 × 6 + 9 × 3 + 86 × 1/2 = 100

    (0, 20, 80); (5, 9, 86)

    There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.

    Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.

  12. Trout, carp, bleak

    The three types are trout, carp, bleak. Their unit prices, in the same order, are 8, 3, 1/4 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    8 × x + 3 × y + 1/4 × z = 100

    2. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain 31x + 11y = 300. The gcd is 1; dividing by 1 leaves 31x + 11y = 300.

    32x + 12y + 1z = 400
    32x + 12y + 1(100 - x - y) = 400

    3. Reduce modulo 11: 31x ≡ 300 (mod 11). Bézout’s identity 31 × (5) + 11 × (-14) = 1 shows that (5) is an inverse of 31 modulo 11. Hence x ≡ (5) × 300 ≡ 4 (mod 11). All candidates are x = 4 + 11k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 9. Substituting the family into the other counts gives x = 4 + 11k, y = 16 - 31k, z = 80 + 20k. The constraints become 4 + 11k ≥ 0 → k ≥ 0; 16 - 31k ≥ 0 → k ≤ 0; 80 + 20k ≥ 0 → k ≥ -4. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 4. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    trout (x)carp (y)bleak (z)Total animalsCost check
    416801004 × 8 + 16 × 3 + 80 × 1/4 = 100

    (4, 16, 80)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

  13. Dogs, cats, hamsters

    The three types are dogs, cats, hamsters. Their unit prices, in the same order, are 10, 2, 1/3 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    10 × x + 2 × y + 1/3 × z = 100

    2. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain 29x + 5y = 200. The gcd is 1; dividing by 1 leaves 29x + 5y = 200.

    30x + 6y + 1z = 300
    30x + 6y + 1(100 - x - y) = 300

    3. Reduce modulo 5: 29x ≡ 200 (mod 5). Bézout’s identity 29 × (4) + 5 × (-23) = 1 shows that (4) is an inverse of 29 modulo 5. Hence x ≡ (4) × 200 ≡ 0 (mod 5). All candidates are x = 0 + 5k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 6. Substituting the family into the other counts gives x = 0 + 5k, y = 40 - 29k, z = 60 + 24k. The constraints become 0 + 5k ≥ 0 → k ≥ 0; 40 - 29k ≥ 0 → k ≤ 1; 60 + 24k ≥ 0 → k ≥ -2. Intersecting the three bounds gives 0 ≤ k ≤ 1. The allowed x values are 0, 5. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    dogs (x)cats (y)hamsters (z)Total animalsCost check
    040601000 × 10 + 40 × 2 + 60 × 1/3 = 100
    511841005 × 10 + 11 × 2 + 84 × 1/3 = 100

    (0, 40, 60); (5, 11, 84)

    There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.

    Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.

  14. Turkeys, ducks, chicks

    The three types are turkeys, ducks, chicks. Their unit prices, in the same order, are 15, 3, 1/3 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    15 × x + 3 × y + 1/3 × z = 100

    2. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain 44x + 8y = 200. The gcd is 4; dividing by 4 leaves 11x + 2y = 50.

    45x + 9y + 1z = 300
    45x + 9y + 1(100 - x - y) = 300

    3. Reduce modulo 2: 11x ≡ 50 (mod 2). Bézout’s identity 11 × (1) + 2 × (-5) = 1 shows that (1) is an inverse of 11 modulo 2. Hence x ≡ (1) × 50 ≡ 0 (mod 2). All candidates are x = 0 + 2k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 4. Substituting the family into the other counts gives x = 0 + 2k, y = 25 - 11k, z = 75 + 9k. The constraints become 0 + 2k ≥ 0 → k ≥ 0; 25 - 11k ≥ 0 → k ≤ 2; 75 + 9k ≥ 0 → k ≥ -8. Intersecting the three bounds gives 0 ≤ k ≤ 2. The allowed x values are 0, 2, 4. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    turkeys (x)ducks (y)chicks (z)Total animalsCost check
    025751000 × 15 + 25 × 3 + 75 × 1/3 = 100
    214841002 × 15 + 14 × 3 + 84 × 1/3 = 100
    43931004 × 15 + 3 × 3 + 93 × 1/3 = 100

    (0, 25, 75); (2, 14, 84); (4, 3, 93)

    There are 3 non-negative solutions. If we require at least one animal of each type, 2 remain.

    Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.

  15. Rabbits, pigeons, sparrows

    The three types are rabbits, pigeons, sparrows. Their unit prices, in the same order, are 6, 3, 1/4 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    6 × x + 3 × y + 1/4 × z = 100

    2. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain 23x + 11y = 300. The gcd is 1; dividing by 1 leaves 23x + 11y = 300.

    24x + 12y + 1z = 400
    24x + 12y + 1(100 - x - y) = 400

    3. Reduce modulo 11: 23x ≡ 300 (mod 11). Bézout’s identity 23 × (1) + 11 × (-2) = 1 shows that (1) is an inverse of 23 modulo 11. Hence x ≡ (1) × 300 ≡ 3 (mod 11). All candidates are x = 3 + 11k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 13. Substituting the family into the other counts gives x = 3 + 11k, y = 21 - 23k, z = 76 + 12k. The constraints become 3 + 11k ≥ 0 → k ≥ 0; 21 - 23k ≥ 0 → k ≤ 0; 76 + 12k ≥ 0 → k ≥ -6. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 3. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    rabbits (x)pigeons (y)sparrows (z)Total animalsCost check
    321761003 × 6 + 21 × 3 + 76 × 1/4 = 100

    (3, 21, 76)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

  16. Cows, pigs, chicks

    The three types are cows, pigs, chicks. Their unit prices, in the same order, are 8, 5, 1/4 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    8 × x + 5 × y + 1/4 × z = 100

    2. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain 31x + 19y = 300. The gcd is 1; dividing by 1 leaves 31x + 19y = 300.

    32x + 20y + 1z = 400
    32x + 20y + 1(100 - x - y) = 400

    3. Reduce modulo 19: 31x ≡ 300 (mod 19). Bézout’s identity 31 × (8) + 19 × (-13) = 1 shows that (8) is an inverse of 31 modulo 19. Hence x ≡ (8) × 300 ≡ 6 (mod 19). All candidates are x = 6 + 19k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 9. Substituting the family into the other counts gives x = 6 + 19k, y = 6 - 31k, z = 88 + 12k. The constraints become 6 + 19k ≥ 0 → k ≥ 0; 6 - 31k ≥ 0 → k ≤ 0; 88 + 12k ≥ 0 → k ≥ -7. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 6. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    cows (x)pigs (y)chicks (z)Total animalsCost check
    66881006 × 8 + 6 × 5 + 88 × 1/4 = 100

    (6, 6, 88)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

  17. Swans, geese, sparrows

    The three types are swans, geese, sparrows. Their unit prices, in the same order, are 11, 2, 1/4 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    11 × x + 2 × y + 1/4 × z = 100

    2. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain 43x + 7y = 300. The gcd is 1; dividing by 1 leaves 43x + 7y = 300.

    44x + 8y + 1z = 400
    44x + 8y + 1(100 - x - y) = 400

    3. Reduce modulo 7: 43x ≡ 300 (mod 7). Bézout’s identity 43 × (1) + 7 × (-6) = 1 shows that (1) is an inverse of 43 modulo 7. Hence x ≡ (1) × 300 ≡ 6 (mod 7). All candidates are x = 6 + 7k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 6. Substituting the family into the other counts gives x = 6 + 7k, y = 6 - 43k, z = 88 + 36k. The constraints become 6 + 7k ≥ 0 → k ≥ 0; 6 - 43k ≥ 0 → k ≤ 0; 88 + 36k ≥ 0 → k ≥ -2. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 6. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    swans (x)geese (y)sparrows (z)Total animalsCost check
    66881006 × 11 + 6 × 2 + 88 × 1/4 = 100

    (6, 6, 88)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

  18. Goats, hens, chicks

    The three types are goats, hens, chicks. Their unit prices, in the same order, are 5, 2, 1/3 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    5 × x + 2 × y + 1/3 × z = 100

    2. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain 14x + 5y = 200. The gcd is 1; dividing by 1 leaves 14x + 5y = 200.

    15x + 6y + 1z = 300
    15x + 6y + 1(100 - x - y) = 300

    3. Reduce modulo 5: 14x ≡ 200 (mod 5). Bézout’s identity 14 × (4) + 5 × (-11) = 1 shows that (4) is an inverse of 14 modulo 5. Hence x ≡ (4) × 200 ≡ 0 (mod 5). All candidates are x = 0 + 5k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 14. Substituting the family into the other counts gives x = 0 + 5k, y = 40 - 14k, z = 60 + 9k. The constraints become 0 + 5k ≥ 0 → k ≥ 0; 40 - 14k ≥ 0 → k ≤ 2; 60 + 9k ≥ 0 → k ≥ -6. Intersecting the three bounds gives 0 ≤ k ≤ 2. The allowed x values are 0, 5, 10. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    goats (x)hens (y)chicks (z)Total animalsCost check
    040601000 × 5 + 40 × 2 + 60 × 1/3 = 100
    526691005 × 5 + 26 × 2 + 69 × 1/3 = 100
    10127810010 × 5 + 12 × 2 + 78 × 1/3 = 100

    (0, 40, 60); (5, 26, 69); (10, 12, 78)

    There are 3 non-negative solutions. If we require at least one animal of each type, 2 remain.

    Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.

  19. Horses, donkeys, sheep

    The three types are horses, donkeys, sheep. Their unit prices, in the same order, are 7, 5, 1/3 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    7 × x + 5 × y + 1/3 × z = 100

    2. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain 20x + 14y = 200. The gcd is 2; dividing by 2 leaves 10x + 7y = 100.

    21x + 15y + 1z = 300
    21x + 15y + 1(100 - x - y) = 300

    3. Reduce modulo 7: 10x ≡ 100 (mod 7). Bézout’s identity 10 × (5) + 7 × (-7) = 1 shows that (5) is an inverse of 10 modulo 7. Hence x ≡ (5) × 100 ≡ 3 (mod 7). All candidates are x = 3 + 7k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 10. Substituting the family into the other counts gives x = 3 + 7k, y = 10 - 10k, z = 87 + 3k. The constraints become 3 + 7k ≥ 0 → k ≥ 0; 10 - 10k ≥ 0 → k ≤ 1; 87 + 3k ≥ 0 → k ≥ -29. Intersecting the three bounds gives 0 ≤ k ≤ 1. The allowed x values are 3, 10. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    horses (x)donkeys (y)sheep (z)Total animalsCost check
    310871003 × 7 + 10 × 5 + 87 × 1/3 = 100
    1009010010 × 7 + 0 × 5 + 90 × 1/3 = 100

    (3, 10, 87); (10, 0, 90)

    There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.

    Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.

  20. Oxen, rams, lambs

    The three types are oxen, rams, lambs. Their unit prices, in the same order, are 9, 6, 1/4 coins. How many animals of each type can you buy while meeting both totals?

    Show solution and method

    1. Choose the unknowns in the stated order: x, y, z. The two conditions are:

    x + y + z = 100
    9 × x + 6 × y + 1/4 × z = 100

    2. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain 35x + 23y = 300. The gcd is 1; dividing by 1 leaves 35x + 23y = 300.

    36x + 24y + 1z = 400
    36x + 24y + 1(100 - x - y) = 400

    3. Reduce modulo 23: 35x ≡ 300 (mod 23). Bézout’s identity 35 × (2) + 23 × (-3) = 1 shows that (2) is an inverse of 35 modulo 23. Hence x ≡ (2) × 300 ≡ 2 (mod 23). All candidates are x = 2 + 23k, with integer k.

    4. From y ≥ 0 we obtain x ≤ 8. Substituting the family into the other counts gives x = 2 + 23k, y = 10 - 35k, z = 88 + 12k. The constraints become 2 + 23k ≥ 0 → k ≥ 0; 10 - 35k ≥ 0 → k ≤ 0; 88 + 12k ≥ 0 → k ≥ -7. Intersecting the three bounds gives 0 ≤ k ≤ 0. The allowed x values are 2. This interval exhausts all possibilities.

    5. Every solution, in the stated order

    oxen (x)rams (y)lambs (z)Total animalsCost check
    210881002 × 9 + 10 × 6 + 88 × 1/4 = 100

    (2, 10, 88)

    There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.

6. Conclusion

The animal names and coins provide a story: the method works for any three goods with rational prices.

Remember the sequence: two equations → elimination → integer coefficients → gcd → solution family → bounds → verification. Finding one triple does not prove uniqueness; determining the entire parameter interval does.