Hey, the problem is as follows:
As hungry child walks into a store where the cost of a gum is $0.5, a snickers is $4, and a cola is $9. The child buys a few of each sort adding up to a total of 34 items for the exact cost of $97. How many of each did he get?
My attempt:
0.5x+4y+9z=97 since we only deal with integers I multiply by 2:
x+8y+18z=194, I also know that x+y+z=34 hence x=34-y-z. I plug that into my diophantine equation.
7y+17z=160, Solving with Euclid's Algorithm I eventually stumble upon y0=5 and z0=-2.
This gives me (y,z)=(160*y0+17n,160*z0-7n).
I plug it into x=34-y-z and get x=-446-10n. But how do I now solve for actual values of x,y,z?
As hungry child walks into a store where the cost of a gum is $0.5, a snickers is $4, and a cola is $9. The child buys a few of each sort adding up to a total of 34 items for the exact cost of $97. How many of each did he get?
My attempt:
0.5x+4y+9z=97 since we only deal with integers I multiply by 2:
x+8y+18z=194, I also know that x+y+z=34 hence x=34-y-z. I plug that into my diophantine equation.
7y+17z=160, Solving with Euclid's Algorithm I eventually stumble upon y0=5 and z0=-2.
This gives me (y,z)=(160*y0+17n,160*z0-7n).
I plug it into x=34-y-z and get x=-446-10n. But how do I now solve for actual values of x,y,z?