Week 9: Number Theory Flashcards

1
Q

division

A
  • let a and b be two integers with a not equal to 0
  • we say that a divides b if there is an integer k such that b = ka
  • we write a | b if a divides b
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

notation of division

A
  • “a divides b” is denoted by a | b (ex. 3 | 21)
  • 3 is a factor of 21, 3 is a divisor of 21, 21 is a multiple of 3
  • “a does not divide b” is denoted by a ∤b (| with slash in it) (ex. 3 ∤ 20)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

division - theorem 1 (3 things)

A
  • let a, b, c be integers where a is not equal to 0
  • if a ∣ b and a ∣ c, then a ∣ (b + c)
  • If a ∣ b, then a ∣ bc for all integers c
  • If a ∣ b and b ∣ c, then a ∣ c
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

proof for part a of theorem 1: if a | b and a |c, then a | (b + c)

A
  • a | b means b = ma for some integer m
  • a | c means c = na for some integer n
  • b + c = (m + n ) a, thus a | (b+c)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

proof for part b of theorem 1: if a | b and a |bc for all integers c

A
  • a | b means b = ma for some integer m
  • bc = (mc)a, mc is an integer
  • thus a | bc
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

proof for part c of theorem 1: if a | b and b | c, then a | c

A
  • a | b means b = ma for some integer m
  • b | c means c = nb for some integer n
  • c = nb = (nm)a, thus a | c.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

the division algorithm

A
  • let a be an integer and d a POSITIVE integer
  • then there are unique ints q and r with 0 ≤ r < d, such that a = dq + r
  • a is dividend, d divisor, q quotient, r remainder
  • notation: q = a div d, r = a mod d
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

modular arithmetic

A
  • let a and b be integer and M is a positive integer
  • say that a is congruent to b modulo M if M divides a - b
  • we shall write a ≡ b (mod M) if and only if M | (a – b)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

modular exponentiation

A
  • can apply modular arithmetic rules on exponents
  • break down the exponent according to binary
  • review with videos/something to understand
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

fast modular exponentiation

A

procedure modular_exp(b, n = 𝑎𝑘−1𝑎𝑘−2 … 𝑎1𝑎0 2 , m):
# 𝑎𝑘−1𝑎𝑘−2 … 𝑎1𝑎0 2 is the binary representation of n
x = 1
power = b % m
for i = 0 to (k-1)
if a[i] == 1
then x := (x * power) % m
power := (power * power) % m
return x
#x equals 𝑏𝑛 𝑚𝑜𝑑 𝑚
12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

primes

A
  • a prime number p is an integer greater than 1 that is divisible ONLY by one and itself
  • there are an infinite number of prime number
  • ex. 2, 3, 5, 7, 11, 13…
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

composite

A
  • term for a number that is not prime
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

fundamental theorem of arithmetics

A
  • Every positive integer can be written as the product of primes where the prime factors are written in order of
    increasing size
    -if n is a natural numbers and p1 < p2 < ⋯ < pm are distinct primes, then
  • n = p1^(e1) ⋅ p2^(e2) ⋯ pm^(em)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

primes - theorem to determine if number is composite

A

If 𝑛 is a composite integer, then n has a prime divisor less than or equal to √𝑛.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

sieve of eratosthenes

A
  • used to find all primes not exceeding a specified positive integer
  • can write out all the numbers, go number by number, and remove anything that is divisible by that number
  • will be left with prime numbers
  • can be implemented with code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

greatest common divisors

A
  • the largest divisor that divides both m and n is called the greatest common divisor of m and m
  • denoted as gcd(m, n)
17
Q

euclidean algorithm

A

-Let a = bq + r, where a, b, q, and r are integers
-Then gcd(a,b) = gcd(b, r)

18
Q

euclidean algorithm implementation

A

procedure gcd (a, b: positive integers):
x := a
y := b
while y > 0
r := x mod y
x := y
y := r
return x
# x equals to gcd(a, b)

19
Q

bezout’s theorem

A
  • If a and b are positive integers, then there exist integers s and t such that gcd(a, b) = sa + tb.
  • gcd(a, b) can be expressed as a linear combination of a and b
20
Q

hashing functions

A
  • one needs a fast method of locating a given record in a huge set of records
  • hashing is a possible solution, where every record has a unique key k, and a hashing function h(k) maps the set of keys into the available memory locations
  • most common function is
    h(k) = k mod M (M is memory size)
21
Q

pseudo random number generator

22
Q

classical cryptography

23
Q

caeser cipher

A
  • encrypting a message by a certain shift
  • ex. shifting 3 letters forward
    B -> E, Z -> C
24
Q

the encryption function

A

encrypt(c) = (c + 3) mod 26
- shift is 3 in this example
- codes the message

25
the decryption function
decrypt(c) = (c – 3) mod 26 - shifts back 3 in this example - decodes the message
26
the RSA cryptosystem
- the most widely used public key cryptosystem - public key cryptosystems made it practical to send encrypted messages between parties ex. seller and buyer
27
preparation of public and private keys in RSA
- two prime numbers, p and q - computes N = p*q and φ = (p-1)(q-1) - finds an integer e such that gcd(e, φ) = 1 - computes d, the multiplicative inverse of e mod φ: (e * d mod φ) = 1 - public key is N and e, private key is d
28
the Chinese remainder theorem
29
Fermat's little theorem
If p is a prime number and m is an integer not divisible by p, then m^(p-1) ≡ 1 mod p Or equivalently m^p ≡ m mod p
30
rules of modular arithmetic (5 things)
- If a ≡ b (mod M) and c ≡ d (mod M) - a + c ≡ b + d (mod M) - ac ≡ bd (mod M) - (a + b) mod M = ((a mod M) + (b mod M)) mod M - (ab) mod M = ((a mod M) x (b mod M)) mod M
31
relatively prime
- integer of a and b are relatively prime if their greatest common divisor is 1 - ex. gcd(25, 36) = 1
32
modular arithmetic and congruency
- a and b are integers, M is a positive integer - a is congruent to b modulo M if M divides a - b - statement: a = b (mod M) iff M | (a - b)
33
modular arithmetic addition/multiplication rule with a, b, c, d
- a = b (mod M) and c = d (mod M) 1.) a + c = b + d (mod M) 2.) ac ≡ bd (mod M)
34
modular arithmetic addition/multiplication rule with a, b
Let M be a positive integer; and let a and b be integers. Then (a + b) mod M = ((a mod M) + (b mod M)) mod M (ab) mod M = ((a mod M) x (b mod M)) mod M
35
how many prime numbers are there
infinitely many
36
public key and private key formulas
- Public key: N and e C = encrypt(M) = M^e (mod N) - Private key: d M = decrypt(C) = C ^ d (mod N)
37
inverse modulo N
b is an inverse of a modulo N if b* a ≡ 1 mod N
38
theorem for inverse modulo N
- m > 1 and gcd(m, n) = 1 (i.e., m and n are relatively prime), then an inverse of n modulo m exists and it is - equal to s in the following equation: s x n + t x m = 1 - can be found efficiently by the extended Euclidean algorithm