Using Fermat's Little Theorem and Fast Powers to Solve Multiplicative Inverses

1. What is Fermat's Little Theorem

If p is a prime number and the integer a is not a multiple of p, then
ap − 1 ≡ 1 ( modp ) a^{p-1}\,≡1(mod p)ap11 m o d p

2. Proof of Fermat's Little Theorem

Fermat's little theorem (easy to understand) - Gan Yi's article - Know
the proof of Fermat's little theorem

3. Quick Power

Algorithm Study Notes (4): Fast Power - Pecco's Article - Zhihu
Fast Power Explained Detailed Version
Reprinted from:
Fast Power Explained Non-recursive Detailed Version

Guess you like

Origin blog.csdn.net/qq_63087425/article/details/130898699