I can't seem to understand why the inverse of $2 \mod 127=64$
I used the Euclidean algorithm:
$2x=1 \mod127$
$127=63\cdot 2+1$
$1=127-63\cdot 2 \mod127$
$x=63$?
I'm pretty sure it's a really stupid error....please help!
I can't seem to understand why the inverse of $2 \mod 127=64$
I used the Euclidean algorithm:
$2x=1 \mod127$
$127=63\cdot 2+1$
$1=127-63\cdot 2 \mod127$
$x=63$?
I'm pretty sure it's a really stupid error....please help!
More simply: $\ {\rm mod}\ m = 2n\!-\!1\!:\,\ 2n\equiv 1\,\Rightarrow\, 2^{-1}\equiv n\equiv (m\!+\!1)/2\,\ $ [$\equiv (127\!+\!1)/2\equiv 64$ ]
Remark $\ $ The same idea works to compute $\, a^{-1}\!\pmod{an\pm1},\,$ i.e. when $\,m \equiv \pm1\pmod{a}$. This will often be simpler than using the Extended Euclidean algorithm, so may help to avoid errors, such as your omitting the sign on $\,63.$