$\gcd(198,288,512)=198x+288y+512z$; $x,y,z\in\Bbb Z$; solve for $x,y,z$ I stuck this problem I can solve for 2 variable, but 3 variable or more I have no idea about it. Anyone can give me a hint?
 A: Cancelling $2$ it suffices to solve $\,\gcd(256,144,99) = 256 z + 144 y + 99 x,\,$ which is straightforward using a version of the extended Euclidean algorithm described here, namely
$$\rm\begin{eqnarray}(1)\quad 256\!\ &=&\ \  1&\cdot& 256\ +\ \  0 &\cdot& 144\ +\ 0 &\cdot& 99 \\ 
(2)\quad 144 \ &=&\ \  0 &\cdot& 256 \ +\ \ 1 &\cdot& 144\ +\  0&\cdot& 99\\
          (3)\ \,\quad  99 \ &=&\ \  0 &\cdot& 256 \ +\ \ 0&\cdot& 144\ +\  1&\cdot& 99\\
2(2)-(1)\,\rightarrow\, (4)\ \ \quad 32 &=& {-}1&\cdot&256\ +\ \ 2&\cdot&144\ +\ 0&\cdot& 99\\
(3)\!\!-3(4)\,\rightarrow\, (5)\ \ \ \ \quad3 &=&\ \ 3&\cdot&256\ \  -\ 6&\cdot&144\ +\ 1&\cdot&99\\
11(5)-(4)\,\rightarrow\,(6)\ \ \ \ \quad 1 &\,=\,& 34&\cdot&256 \,-68&\cdot&144+11&\cdot&99
\end{eqnarray}\qquad$$ 
See here for another worked example, and see here for an explicit formula for the general trivariate linear Diophantine equation (in terms of solutions of associated bivariate equations).
A: You can solve it using different combinations.There are four possible cases.
$$\begin{cases}x=y&(1)\\y=z&(2)\\x=z&(3)\\x\neq y\neq z&(4)\end{cases}$$
Solutions possible in case $(1)$:
$$\begin{align}
198x+288y+512z&=2&[x=y]\\
486x+512z&=2\\
512-486&=26\\
(26*a)-2&\neq512b\\
(26*c)-2&\neq486d\\
\end{align}$$
So case $(1)$ has no solutions. Similarly for case $(3)$ no solution exists.
For case $(2)$:
$$800z+198x=2$$
It means either $x$ or $z$ should be negative.
Since the last digit of $800z$ is $0$, the last digit of $198x$ must be $8$.
It means we can take $x$ as a digit which ends with 1.
Since the last second digit of $800z$ is $0$ the last second digit in $198x$ must be $9$. To get a value $9$ in $10$s place we need to consider digit $0$ in $10$s place for $x$.
$$\frac{800}{198}\approx4\implies z\approx4x$$
By considering all, we get solutions as
$$\begin{align}
x_1&=101,&z_1&=25\\
x_2&=501,&z_2&=124\\
&\vdots\\
x_n&=400+x_n-1,&z_n&=z_n-1 +4 (z_1) -1,&y_n&=z_n
\end{align}$$
It means infinite solutions exist as according to case $(3)$.
Solution to case four is already given by fleablood.
