<s>[INST] Linear diophantine equation $100x - 23y = -19$ I need help with this equation: $$100x - 23y = -19.$$  When I plug this into Wolfram|Alpha, one of the integer solutions is $x = 23n + 12$ where $n$ is a subset of all the integers, but I can't seem to figure out how they got to that answer.
 [/INST] The continued fraction solution goes as follows:
Expand 100/23 into a continued fraction (I'm essentially using the GCD algorithm):
\begin{align*}
\frac{100}{23} & = 4 + \frac{8}{23}\\
               & = 4 + \frac{1}{\frac{23}{8}}\\
               & = 4 + \cfrac{1}{2 + \cfrac{7}{8}}\\
               & = 4 + \cfrac{1}{2 + \cfrac{1}{\frac{8}{7}}}\\
               & = 4 + \cfrac{1}{2 + \cfrac{1}{1 + \cfrac{1}{7}}}
\end{align*} 
Now that all the numerators are $1$, you're done getting the continued fraction, often written as the list of partial quotients like this:
$100/23 = [4,2,1,7]$
You can of course check: $4 + 1/(2 + 1/(1 + 1/7)) = 100/23$, the last equation above.  You can change the $7$ at the end to $6 + 1/1$ to get an odd number of partial quotients but you don't have to.
Now if you look at $[4,2,1]$, which is the next to last convergent (the last being $[4,2,1,7]=100/23$) you get
$$4 + \frac{1}{2 + \frac{1}{1}} = \frac{13}{3}$$
The difference of cross product of the numerators and denominators of successive convergents is always $+1$ or $-1$, i.e:
$$100 \cdot 3 - 13 \cdot 23 = 1$$
If we multiply though by $-19$ we get:
$$100 \cdot (3 \cdot -19) - 23 \cdot (13 \cdot -19) = -19$$
so a particular solution $x_0,y_0$ is
\begin{align*}
x_0 & = 3 \cdot -19 = -57\\
y_0 & = 13 \cdot -19 = -247
\end{align*}
Since for all integer $t$
$$100 \cdot 23t  -  23 \cdot 100t = 0$$
we can add that equation to
$$100 \cdot -57   -  23 \cdot -247 = -19$$
and get
$$100(23t-57) - 23(100t-247) = -19$$
so the general solution is
\begin{align*}
x & = 23t - 57\\
y & = 100t - 247
\end{align*}
To get the exact Wolfram answer change variables to $n = t-3$
$$x = 23(n+3)-57 = 23n+69-57 = 23n + 12$$
</s>