A farmer buys 100 animals for $100.00. The animals include at least one cow, one pig, and one chicken, but no other kind. If a cow costs $10.00, a pig costs $3.00, and a chicken costs $0.50, how many of each did he buy? Please show me the best way to set this out in Mathematica
That's the only solution.
Reduce[{10 x + 3 y + z/2 == 100, x + y + z == 100, x >= 1, y >= 1, z >= 1}, {x, y, z}, Integers]
x == 5 && y == 1 && z == 94
Here is one solution: The farmer should buy 5 cows, 1 pig and 94 chickens.
In one line Mathematica code.
FindInstance[{10 x+3 y+.5 z==100,x+y+z==100,x>= 1,y>= 1,z>=1},{x,y,z},Integers]