<s>[INST] Find the inverse of 17 mod 41 Questions
(1) Find the inverse of $17 \mod 41$.
(2) Find the smallest positive number n so that $17n \equiv 14 \pmod{41}$

For the first question, my attempt is as follows:
$$41-17\cdot2=7$$
$$17-7\cdot2=3$$
$$7-3\cdot2=1$$
$$7-2(17-7\cdot2)=1$$
$$7-2\cdot17=1$$
$$41-17\cdot2-2\cdot17=1$$
$$41-4\cdot17=1$$
So the inverse of $17$ is $-4$.
That is, the inverse of $17$ is $37$
Am I right?
 [/INST] \begin{align*}
    41 &= 2 \cdot 17 + 7  &  7 &= 1 \cdot 41 - 2 \cdot 17  \\
    17 &= 2 \cdot 7 + 3   &  3 &= 1 \cdot 17 - 2 \cdot (1 \cdot 41 - 2 \cdot 17)  \\
                         &&    &= 5 \cdot 17 - 2 \cdot 41  \\
     7 &= 2 \cdot 3 + 1   &  1 &= 1 \cdot 7 - 2 \cdot 3  \\
                         &&    &= 1\cdot(1 \cdot 41 - 2 \cdot 17) - 2 \cdot (5 \cdot 17 - 2 \cdot 41)  \\
                         &&    &= 5 \cdot 41 - 12 \cdot 17
\end{align*}
Therefore $17^{-1} \cong -12 \cong 29 \pmod{41}$.
</s>