S1, C5-6: Modular Arithmetic Flashcards
Positive integers written as a product of prime numbers
Every positive integer can be written as a product of prime numbers in exactly one way.
How many prime numbers are there? (Euclid’s Theorem)
Infinitely many
Coprime
Two integers, a and b, are said to be coprime or relatively prime if gcd(a, b)=1.
Congruence
We say that a is congruent to b modulo m if
m|(a-b)
Let a and b be integers. There is an integer b such that ab is congruent to 1 mod m iff…
gcd(a, m)= 1
Modular inverse
When there is a number b such that ab is congruent to 1 (mod m), we call it the inverse of a mod m. And then a is invertible.
Chinese Remainder Theorem
Let m1 and m2 be coprime, and let a1 and a2 be any integers. The simultaneous congruences
x (congruent to) a1 (mod m1)
x (congruent to) a2 (mod m2)
have a solution modulo m1m2.
When can you find a +ve n s.t. a^n is congruent to 1 mod m?
When a and m are coprime.
Fermat’s Little Theorem
Let p be prime, and let a be an integer coprime to p. Then
a^(p-1) is congruent to 1 mod p.
Fermat-Euler Theorem. Let a and n be integers with
gcd(a, n) = 1. Then a^(ϕ(n)) is congruent to
a^(ϕ(n)) is congruent to 1 mod n.
Euler’s function / Totient function: ϕ(n)
ϕ: N -> N is defined by taking ϕ(n) to be the number of integers between 1 and n (inclusive) which are coprime to n.
Wilson’s Theorem. We have (n-1)! congruent to -1 (mod n) iff
n is prime