Solution (source code)

= Solution

The <Euclidean algorithm> gives
$$
18=2\cdot7+4,\qquad 7=4+3,\qquad 4=3+1.
$$
Back-substitution supplies the <Bezout identity>
$$
1=4-3=2\cdot4-7=2(18-2\cdot7)-7=2\cdot18-5\cdot7.
$$
Thus one solution is $(x,y)=(-5,2)$. If $(x,y)$ is any solution, subtraction gives $7(x+5)+18(y-2)=0$. Since $7$ and $18$ are coprime, $18$ divides $x+5$. Write $x+5=18t$; substitution then gives $y-2=-7t$. Conversely these values satisfy the equation for every <integer> $t$. Hence \b[all solutions] are
$$
\boxed{x=-5+18t,\qquad y=2-7t,\qquad t\in\mathbb Z.}
$$