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?

For the first Q.
Let $17=x_1.$ For each $n,$ if $|x_n|>1,$ take positive integer $K_n$ such that $$|K_nx_n|<41<|(1+K_n)x_n| .$$ Take $x_{n+1}$ with $41>|x_{n+1}|$ where: ...
(i). If $41-|K_nx_n|<|(1+K_n)x_n|-41$ then $x_{n+1}\equiv K_nx_n \pmod {41}$...
(ii). Otherwise $x_{n+1}\equiv (1+K_n)x_n \pmod {41}.$ 
(This is faster than simply taking $x_{n+1}\equiv 41- K_nx_n \pmod {41},$ as it ensures that if $|x_n|>1$ then $|x_{n+1}|\leq |x_n|/2.)$ 
If $|x_n|=1$ then stop. 
We have $17=x_1$ and $34=17\cdot 2<41<17\cdot 3=51$ so $K_1=2.$ We have $41-34<51-41$ so we take $x_2\equiv 17\cdot 2   \pmod {41}$ . That is, $x_2=-7$. Now we have $35=5|x_2|<41<6|x_2|=42$ so $K_2=5$. And $41-35>42-41$ so we take $x_3\equiv  (1+K_2)x_2  \pmod {41}.$ That is, $x_3= -1.$
Now modulo 41 we have  $-1\equiv (1+k_2)\cdot k_1\cdot 17 \equiv 6\cdot 2\cdot 17 \equiv 12\cdot 17.$ Therefore $1\equiv (-12)17\equiv 29\cdot 17.$ 
