A farmer spent $100 to buy 100 animals of three different kinds. Each cow cost $10, each pig $3, and each sheep 50 cents. Assuming he bought at least one of each, how many of each animal did the farmer buy?
Note: Most of this analysis is from the book "Wheels, Life and other Mathematical Amusements" by Martin Gardner. I own this book and many other books by him.
There are two equations in three unknowns, where x is the number of cows, y the number of pigs, and z the number of sheep.
Solve the first equation for z, and multiply the second equation by 2 to remove the fraction.
Eliminate z from the second equation.
Use continued fractions to find integral values of x and y.
We now have: y = 20 - 3x - 4x/5. For x and y to be integers, x must have a positive value that makes 4x/5 an integer, so x must be a multiple of 5.
The one and only solution to this problem is when x = 5, y = 1, and z = 94. The means the farmer bought 5 cows, 1 pig, and 94 sheep for a cost of $10 * 5 + $3 * 1 + $0.50 * 94 = $50 + $3 + $47 = $100.
Question: Is there a solution if cows cost $5, pigs are $2, and sheep are $0.50? What if cows are $4, pigs are $2, and sheep are one-third of a dollar?