^ That certainly works well enough.
Here's an approach using 3 and Euclid's algorithm. Note, this turned out to be "easy" right away. The idea is to continue the algorithm until you get "1" and reverse it.
\(\displaystyle 256 = 3(85) + 1\) so,
\(\displaystyle 256 + 3(-85)= 1 \)
Now, mod 256 this says that \(\displaystyle 256 + 3(171) = 1\) and so \(\displaystyle 3(171) \equiv 1 (\text{mod 256})\)
Hence \(\displaystyle 81(171^4) \equiv81(177) \equiv 1 (\text{ mod 256})\), i.e., \(\displaystyle x=177\)
---
Now, if we didn't have that \(\displaystyle 81=3^4\) we would have more work to do, so I will do it that way.
\(\displaystyle 256 = 81(3) + 13\)
\(\displaystyle 81 = 13(6) + 3\)
\(\displaystyle 13 = 3(4) + 1\)
Now we go backwards (never multiply out any 81s or 256s going backwards, we want a linear combination):
(3): \(\displaystyle 1= 13-3(4)\)
(2): \(\displaystyle 3= 81-13(6)\)
(1): \(\displaystyle 13 = 256-81(3)\)
Plug (2) into (3)
(4): \(\displaystyle 1= 13-[81-13(6)](4) = (-4)81+(25)13\)
Plug (1) into (4):
\(\displaystyle 1 = (-4)(81) + 25[256-81(3)] = 256(25) + 81(-79)\)
Therefore \(\displaystyle 81(-79)\equiv 1 (\text{ mod } 256)\), and of course \(\displaystyle -79 \equiv 177\)
This always works...