How to get integer values for x and y that satisfy: $$54 x + 16 y = 2400$$
Someone told me that I can do it using Euclid-Wallis algorithm, but I don't understand it so, if there isn't any else solution, can you explain it to me? I'm elementary.
How to get integer values for x and y that satisfy: $$54 x + 16 y = 2400$$
Someone told me that I can do it using Euclid-Wallis algorithm, but I don't understand it so, if there isn't any else solution, can you explain it to me? I'm elementary.
On
Its a line, so solve for y
y = 150 - 27/8x
which has a y intercept of 150 and an x intercept of ~44. So sample every integer between 0 and 44, and by trial and error you will get all integer roots.
But for this particular case, I can do you one better. The only x integers will have a factor of 8. So {0, 8, 16, 24, 32, 40}. In fact, with any line, the integer solutions will be found at values where both x and y are integers, which in our case will only happen if x is a factor of 8. Therefore there are 6 integer roots. (And to find y plug the x back into the original equation to solve in O(1))
First simplify it to $27x+8y=1200$.
Then $27x = 1200 - 8y = 8(150-y)$.
Since $27$ and $8$ are coprime, this implies that $x=8z$ and so $27z=150-y$.
Therefore, the general solution is $x=8z$, $y=150-27z$.