Hens, Pigs, & Ducks

Once upon a time, after selling his first golden egg laid by the magic goose, Jack received a whole prime number of Shilling coins as a trade. He then wandered through the market, looking for livestock he would bring to his farmland, and found one shop with hens, pigs, and ducks on sales. The three kinds had different prices of whole Shillings per one animal of a kind.

As Jack pondered which animals to buy with all his money, the ingenious merchant skillfully offered these calculated options:

  • Jack could spend all his Shillings on 7 7 hens and 5 5 pigs.
  • Jack could spend all his Shillings on 8 8 pigs and 3 3 ducks.
  • Jack could spend all his Shillings on 4 4 ducks and 9 9 hens.

In the end, Jack wanted all kinds of animals combined and so purchased them with all his Shillings.

How many hen(s), pig(s), and duck(s) did he bring home respectively? Suppose if your answer is 1 1 hen, 2 2 pigs, and 3 3 ducks, submit 123 123 as your answer. (If you think there is no such applicable combination, submit 000 000 as your answer.)


The answer is 237.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

4 solutions

Chris Lewis
May 12, 2019

Use S S for the total Jack has in shillings, and h , p , d h,p,d for the respective prices of hens, pigs and ducks.

S = 7 h + 5 p S=7h+5p

S = 8 p + 3 d S=8p+3d

S = 4 d + 9 h S=4d+9h

Add the second and third of these equations, and subtract the first:

S = 2 h + 3 p + 7 d S=2h+3p+7d giving the answer 237 \boxed{237} .

This is the only order of addition and subtraction that doesn't result in a negative quantity of one of the animals.

Let S S be the total Shillings Jack acquired and x x be the price of each hen, y y be that of each pig, and z z be that of each duck.

Then we can set up the Diophantine equations as followed:

7 x + 5 y = S 7x + 5y = S 8 y + 3 z = S 8y + 3z = S 4 z + 9 x = S 4z + 9x = S

We can then rewrite the whole system as matrix multiplication:

[ 7 5 0 0 8 3 9 0 4 ] [ x y z ] = [ S S S ] = S [ 1 1 1 ] \begin{bmatrix}{7} && {5} && {0} \\ {0} && {8} && {3} \\ {9} && {0} && {4}\end{bmatrix} \begin{bmatrix}{x}\\{y}\\{z}\end{bmatrix} = \begin{bmatrix}{S}\\{S}\\{S}\end{bmatrix} = S\begin{bmatrix}{1}\\{1}\\{1}\end{bmatrix}

The determinant of the 3 × 3 3\times3 matrix equals to 7 × 8 × 4 + 5 × 3 × 9 = 224 + 135 = 359 7\times 8 \times 4 + 5\times 3\times 9 = 224+135 = 359

Hence, solving the equation by multiplying the inverse matrix, we will obtain:

[ x y z ] = S 359 [ 8 × 4 5 × 4 5 × 3 9 × 3 7 × 4 7 × 3 8 × 9 5 × 9 7 × 8 ] [ 1 1 1 ] = S 359 [ 32 20 + 15 27 + 28 21 72 + 45 + 56 ] = S 359 [ 27 34 29 ] \begin{bmatrix}{x}\\{y}\\{z}\end{bmatrix} = \dfrac{S}{359} \begin{bmatrix}{8\times 4} && {-5\times 4} && {5\times 3} \\ {-9\times -3} && {7\times 4} && {-7\times 3} \\ {8\times -9} && {-5\times -9} && {7\times 8}\end{bmatrix} \begin{bmatrix}{1}\\{1}\\{1}\end{bmatrix} = \dfrac{S}{359}\begin{bmatrix}{32-20+15}\\{27+28-21}\\{-72+45+56}\end{bmatrix} = \dfrac{S}{359}\begin{bmatrix}{27}\\{34}\\{29}\end{bmatrix}

Since S S is prime as stated in the question and so is 359 359 , we can conclude that S = 359 S = 359 . Otherwise, x , y , z x,y,z will not be integers and so contradicted. Thus, x = 27 x = 27 ; y = 34 y = 34 ; and z = 29 z = 29 .

Now let us sum up all the costs: x + y + z = 27 + 34 + 29 = 90 x + y +z = 27+34+29 = 90 . Then 359 1 ( m o d 90 ) 359 \equiv 1 \pmod{90} , having 1 1 Shilling short to make up perfect sets of these animals. Therefore, we need to find the way to put this 1 -1 remainder within x , y , z x,y,z combination.

First, let us rewrite y = x + 7 y = x + 7 and z = x + 2 z = x + 2 . Hence, we can rewrite the new Diophantine equation:

359 = 4 x + 4 ( x + 2 ) + 4 ( x + 7 ) 1 = 12 x + 35 359 = 4x + 4(x+2) +4(x+7) -1 = 12x + 35

Now we just need to write 35 35 in terms of 2- and 7-multiples, for a , b a,b stands for numbers of ducks and pigs purchased: 35 = 2 a + 7 b 35 = 2a + 7b .

Clearly, b b needs to be odd because 35 2 a 35-2a is odd, and b < 5 b < 5 because if b 5 b \geq 5 , a a will not be positive integer.

Thus, only b = 1 b=1 or b = 3 b = 3 works. However, if b = 1 b =1 , then a = 14 a = 14 , but 359 27 < 14 \dfrac{359}{27} < 14 , meaning Jack can not buy over 13 13 animals even by buying all the cheapest hens.

As a result, b = 3 b = 3 is the only solution, leading to a = 7 a = 7 .

That means, Jack would be able to buy 3 3 pigs and 7 7 ducks, and by simple subtraction, we will calculate 2 2 hens as well:

2 x + 3 y + 7 z = 2 × 27 + 3 × 34 + 7 × 29 = 359 2x+ 3y + 7z = 2\times 27 + 3\times 34 + 7\times 29 = 359

Finally, Jack had purchased 2 2 hens, 3 3 pigs, and 7 7 ducks.

Chew-Seong Cheong
May 11, 2019

Let the number of gold coins, and the prices of hen, pig, and duck be g g , h h , p p , and d d respectively. Then we have:

{ 7 h + 5 p + 0 d = g . . . ( 1 ) 0 h + 8 p + 3 d = g . . . ( 2 ) 9 h + 0 p + 4 d = g . . . ( 3 ) \begin{cases} 7h + 5p + 0d = g & ...(1) \\ 0h + 8p + 3d = g & ...(2) \\ 9h + 0p + 4d = g & ...(3) \end{cases}

\(\begin{array} {} 8 \times (1) - 5 \times (2): & 56 h + 0p - 15d = 3g & ...(4) \end{array} \)

From 15 × ( 3 ) + 4 × ( 4 ) : 359 h = 27 g 15 \times (3) + 4 \times (4): \ 359 h = 27g . Since g g and 359 are primes and h h an integer, this means that g = 359 g=359 and h = 27 h = 27 . Substituting the two values in ( 1 ) : p = 359 7 ( 27 ) 5 = 34 (1): \implies p = \dfrac {359-7(27)}5 = 34 and ( 3 ) : d = 359 9 ( 27 ) 4 = 29 (3): \implies d = \dfrac {359-9(27)}4 = 29 .

Let the number of hens, pigs, and ducks purchased be k k , m m , and n n respectively. Then we have:

27 k + 34 m + 29 n = 359 359 27 k 29 n 0 (mod 34) 19 + 7 k + 5 n 0 (mod 34) \begin{aligned} 27k + 34m + 29n & = 359 \\ \implies 359 - 27k - 29n & \equiv 0 \text{ (mod 34)} \\ 19 + 7k + 5n & \equiv 0 \text{ (mod 34)} \end{aligned}

Putting k = 1 k=1 26 + 5 n 0 (mod 34) \implies 26 + 5n \equiv 0 \text{ (mod 34)} n 22 \implies n \equiv 22 . But it is unacceptable because 22 > 359 29 = 12 22 > \left \lfloor \dfrac {359}{29} \right \rfloor = 12 the maximum possible value of m m .

Putting k = 2 k=2 33 + 5 n 0 (mod 34) \implies 33+5n \equiv 0 \text{ (mod 34)} n 7 \implies n \equiv 7 acceptable. Implying that m = 359 27 ( 2 ) 29 ( 7 ) 34 = 3 m = \dfrac {359-27(2)-29(7)}{34} = 3 . Therefore, k m n = 237 \overline{kmn} = \boxed{237} .

Edwin Gray
May 17, 2019

Let x,y,z be the unit cost of a hen,pig, and duck respectively. Then we have the equations: 7x + 5y = p, 8y + 3z = p, 4z + 9x = p.By eliminating y and z, we get 359x = 27p. But 359 is a prime, so x = 27. Substituting in the other equations, y = 34 and z = 29. If he went home with a hens, b pigs, and c ducks, then 27a + 34b + 29c = 359. Clearly b < 9. Substituting values for b, and finding a,c results in a + 2, b = 3, c = 7.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...