Divisibility and GCD
Number Theory
- study of integers, that is set
- study Cryptography - secure communication, privacy, e-commerce
- cryptocurrency
Divisibility
Def 1: Divisibility
- Let
- a divides b, denoted by , if there exists some such that
- , (k = 4),
Theorem 2:
- Let
- and then or
- then
- and then (i.e. transitivity)
Corollary 3:
- Let . If and , then for any
Division Algorithm
Theorem 4
- For any and , there exist unique such that and
Definition 5
- In this equation, ,
- d: divisor, a: dividend.
- q is called the quotient, denoted by q = a div d .
- r is called the remainder, denoted by r = a mod d.
Greatest Common Divisor
Definition 6 (GCD)
- with a, b not both = 0. is largest integer d such that and
- Note:
- , , where
Euclid Algorithm
Lemma 7:
- for reducing the problem of finding gcd of 2 large numbers to smaller ones
- ,
- recursive is just like finding remainder of
-
if b=0: return a; else return EuclidAlg(b,a mod b);
Theorem 8
- Euclidβs algorithm (EuclidAlg), on input EuclidAlg(a, b) for , not both 0, always terminates and produces the correct output
Claim 9
- For every two recursive calls made by EuclidAlg, the first argument a is at least reduced by halved
Theorem 10
- Euclidβs algorithm, on input EuclidAlg(a, b) for , a, b not both 0, always terminates in time proportional to
- if a larger, algorithm increase logarithmically, not linearly
Theorem 11 (BΓ©zout Theorem)
- Let a, b β N+, a, b not both 0. Then, there exist s, t (BΓ©zout coefficients) β Z such that (BΓ©zout identity)
- How to compute from
- write out a = b.q + r for each recursive call (from β , for eg) of solving EuclidAlg(a, b), until there is no remainder left
- writing in backward order, from z = elements of β
- compute so that you get the form
Extended Euclidean Algo βββ