Number Theory:
1. Fermat's little theorem:
mod:a mod p is the remainder of dividing a by p Fermat's little theorem: a ^(p- 1 )≡ 1 (mod p) Premise: p is a prime number, and a, p are relatively prime Coprime: a and p have the same factor of 1. Let's take a look at what ≡ is: a≡b(mod p) <=> a mod p=b mod p Note: <=> Both sides are equal Before the proof, the lemma is given: ( 1 ) If p, c are relatively prime, and a*c≡b* c(mod p) proving process: ∵a*c mod p = b*c mod p ∴(a*c - b*c) mod p = 0 ∴(a-b)*c mod p=0; ∴(a -b)* c is a multiple of p ∵p,c coprime ∴k*p*c mod p = 0 ∴(a -b)=k*p // It is recommended that you push with a pen ∴(a -b)%p= 0 ( 2 ) If a1, a2, a3, a4, am are a complete residual system of mod m, and m, b are coprime, then b *a1,b*a2,b*a3,b*a4...b* am is also a complete residual system of mod m. Complete Residual System: Take a number from each residual class modulo n to obtain a set of n numbers, called a complete residual system modulo n. proving process: Using proof by contradiction: Assuming that there exists a b *ai≡b*aj(mod p), it can be proved by lemma ( 1 ) that ai≡aj(mod p) So this assumption does not hold. So Lemma ( 2 ) holds. Begin the proof of Fermat's little theorem: 0 , 1 , 2 , 3 , 4 ... p- 1 is the complete residual system of p ∵a,p coprime ∴a, 2 *a, 3 *a, 4 *a.......(p- 1 )* a is also a complete residue system mod p ∴1*2*3.........*(p-1)*a≡a*2*a*3*a......(p-1)*a (mod p) ∴ (p-1)! ≡ (p-1)!*a^(p-1) (mod p) Make an appointment on both sides at the same time (p - 1 )! a^(p-1)≡1(mod p)