Professional Documents
Culture Documents
• Multiplicative Inverse:
• 𝑥 ∗ 𝑦 ≡ 1 (𝑚𝑜𝑑 𝑚)
Multiplicative inverse using extended
euclidean algorithm
• Use the Extended Euclidean Algorithm with a=n and b
• Do not write down the s-columns
• Continue until r=0.
• Column b on the last row will be gcd(n, b).
• If gcd(n, b) = 1, then we need the value of t2.
• Multiplicative inverse = t2 mod n
Example
• Find multiplicative inverse of 11 in Z26.
n b q r t1 t2 t
26 11 2 4 0 1 -2
11 4 2 3 1 -2 5
4 3 2 1 -2 5 -7
3 1 3 0 5 -7 26
• Number of primes
Checking for primeness
Given a number n, how can we determine if n is a prime? The answer is that we need to see if the
number is divisible by all primes less than √𝑛
• Is 97 a prime?
The floor of 97 = 9. The primes less than 9 are 2, 3, 5, and 7. See if 97 is divisible by any of these
numbers. So 97 is a prime.
• Is 301 a prime?
The floor of 301 = 17. We need to check 2, 3, 5, 7, 11, 13, and 17. The numbers 2, 3, and 5 do not
divide 301, but 7 does. Therefore 301 is not a prime.
Sieve of Eratosthenes
Euler’s Phi-Function
9.10
Continued
9.11
Continued
9.12
Continued
No. The third rule applies when m and n are relatively prime.
Here 49 = 72. We need to use the fourth rule: f(49) = 72 − 71 = 42.
9.13
Fermat’s Little Theorem
First Version
ap − 1 ≡ 1 mod p
Second Version
ap ≡ a mod p
9.14
Continued
Here the exponent (12) and the modulus (11) are not the same.
With substitution this can be solved using Fermat’s little theorem.
9.15
Continued
Multiplicative Inverses
9.16
Euler’s Theorem
First Version
af(n) ≡ 1 (mod n)
Second Version
a k × f(n) + 1 ≡ a (mod n)
9.17
Continued
Multiplicative Inverses
9.19
Generating Primes – Mersenne Primes
Generating Primes – Fermat Primes
F0 = 3 F1 = 5 F2 = 17 F3 = 257 F4 = 65537
F5 = 4294967297 = 641 × 6700417 Not a prime
Factorization
Fundamental Theorem of Arithmetic