美文网首页
Fermat's Little Theorem

Fermat's Little Theorem

作者: Vagacoder | 来源:发表于2018-11-15 09:26 被阅读0次

    Fermat's Little Theorem

    1. Introduction

    Fermat's Little Theorem
    费马小定理

    if p is a prime number, then for any integer a, the number apa is an integer multiple of p. In the notation of modular arithmetic, this is expressed as:

    a pa (mod p)

    If a is not divisible by p, Fermat's little theorem is equivalent to the statement that a p−1−1 is an integer multiple of p, or in symbols:

    a p-1 ≡ 1 (mod p)

    2. Proof

    Step 1. Suppose that a is not divisible by the prime p, no two of the integers 1*a , 2*a , . . . , (p-1)*a are congruent modulo p.

    1. Suppose 2 integer s*a and r*a (both 0 < s and r < p) are congruent modulo p, s*a ≡ r*a (mod p).
    2. Since a ≡ 1(mod p), therefore s ≡ r (mod p).
    3. Since 0 < s and r < p, s = r.
    4. This suggests that no tow of integers 1*a , 2*a , . . . , (p-1)*a are congruent modulo p.

    Step 2. From step 1, we can prove that:

    (p-1) ! ≡ ap-1* (p-1) ! (mod p)

    Since step 1 shows that no two of the integers 1*a , 2*a , . . . , (p-1)*a are congruent modulo p, we conclude that, 1*a mod p, 2*a mod p, .... (p-1)*a mod p, must be different number from 1 to p-1.
    Therefore, (1*a) * (2*a) * ... * ((p-1)*a) mod p = 1*2*...*(p-1) = (p-1)! ≡ (p-1)! mod p.
    Simplify it, we get: ap-1 * (p-1)! ≡ (p-1)! (mod p)

    Step 3. show that ap-1 ≡ 1 (mod p) if p does not divide a .

    Since p is a prime, there is no factor for p from 2 to p-1, therefor gcd(p, (p-1)!) = 1, and we can simplify ap-1 * (p-1)! ≡ (p-1)! (mod p)
    and get: ap-1 ≡ 1 (mod p)

    Step 4. show that a p ≡ a (mod p) for all integers a .

    Since gcd(p, a) = 1, ap-1 ≡ 1 (mod p)
    a*ap-1 ≡ a*1 (mod p) => ap ≡ a (mod p)

    相关文章

      网友评论

          本文标题:Fermat's Little Theorem

          本文链接:https://www.haomeiwen.com/subject/szhjfqtx.html