You are sent to the market by your father with 800 dollars, and told to buy 100 animals. When you arrive at the market, you find out that pigs cost 8 dollars each, so it would be easy to follow your father's instructions.
However, you see that there are only 99 pigs for sale. The only other animals there are chickens for 1 dollar each, and cows for 80 dollars each.
If there are enough chickens and cows for you to buy as many as you wanted, how can you end up buying 100 animals using exactly 800 dollars?
P=#pigs
C=#chickens
K=#cows
(1)P+C+K=100 ; (2)8P+C+80K=800 ; P=<99
(1) in (2) gives 7P=70079K
as P and K are interger and 79 is a prime number, K has to be a multiple of 7. As P is >0, the only solution for K is 7, so P=21 and C=72

Posted by pierre
on 20040219 15:09:37 