0% found this document useful (0 votes)
2 views

O44

The document discusses number theory and cryptography, focusing on the concepts of greatest common divisor (gcd) and prime numbers. It presents theorems related to gcd, algorithms for computing gcd using Euclid's method, and the Extended Euclidean algorithm. Additionally, it explores properties of multiplication modulo m and the computation of inverses in modular arithmetic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

O44

The document discusses number theory and cryptography, focusing on the concepts of greatest common divisor (gcd) and prime numbers. It presents theorems related to gcd, algorithms for computing gcd using Euclid's method, and the Extended Euclidean algorithm. Additionally, it explores properties of multiplication modulo m and the computation of inverses in modular arithmetic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

CSL105: Discrete Mathematical Structures

Ragesh Jaiswal, CSE, IIT Delhi

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


Number Theory and Cryptography

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


Number Theory and Cryptography
Primes and GCD

Theorem
Let a and b be positive integers. Then ab = gcd(a, b) · lcm(a, b).

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

Using the above theorem, design an algorithm to compute gcd


of two n bit numbers. What is the worst-case running time of
your algorithm?

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


Number Theory and Cryptography
Primes and GCD

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

Using the above theorem, design an algorithm to compute gcd


of two n bit numbers. What is the worst-case running time of
your algorithm?

Euclid-GCD(a, b)
If (b = 0) then return(a)
else return(Euclid-GCD(b, a (mod b)))

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


Number Theory and Cryptography
Primes and GCD

Euclid-GCD(a, b)
If (b = 0) then return(a)
else return(Euclid-GCD(b, a (mod b)))

How many recursive calls are made by the algorithm?


What is the worst-case time complexity of the algorithm?

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


Number Theory and Cryptography
Primes and GCD

Theorem
Let a, b be positive integers.Then there exists integers x, y such
that xa + yb = gcd(a, b). Furthermore, gcd(a, b) is the smallest
positive integer that can be expressed in this way.

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


Number Theory and Cryptography
Primes and GCD

Theorem
Let a, b be positive integers.Then there exists integers x, y such
that xa + yb = gcd(a, b). Furthermore, gcd(a, b) is the smallest
positive integer that can be expressed in this way.

Theorem
If a, b, and c are positive integers such that gcd(a, b) = 1 and
a|bc, then a|c.

Theorem
If p is a prime and p|a1 a2 ...an , where each ai is an integer, then
p|ai for some i.

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


Number Theory and Cryptography
Primes and GCD

For any positive integer m, let Zm denote the set


{0, 1, ..., m − 1}.
Consider the set Zm∗ = {x ∈ Zm |gcd(x, m) = 1} and the
operator ·m which is basically the operation multiplication
modulo m.
Show that ·m satisfies the following properties:
Closure
Associativity
Commutativity
Distributivity
Identity
Inverse
How do you compute the inverse of x ∈ Zm∗ modulo m?

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


Number Theory and Cryptography
Primes and GCD

Problem: Given integers a ≥ b > 0, design an algorithm for


computing integers x, y such that xa + yb = gcd(a, b).

Extended-Euclid-GCD(a, b)
If(b = 0), then return(a, 1, 0)
else
Compute integers q, r such that a = qb + r and 0 ≤ r < b.
Let (d, x, y ) = Extended-Euclid-GCD(b, r )
return(d, y , x − yq)

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


Number Theory and Cryptography
Primes and GCD

Problem: Given integers a ≥ b > 0, design an algorithm for


computing integers x, y such that xa + yb = gcd(a, b).

Extended-Euclid-GCD(a, b)
If(b = 0), then return(a, 1, 0)
else
Compute integers q, r such that a = qb + r and 0 ≤ r < b.
Let (d, x, y ) = Extended-Euclid-GCD(b, r )
return(d, y , x − yq)

How do you compute the inverse of x ∈ Zm∗ modulo m?

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures


End

Ragesh Jaiswal, CSE, IIT Delhi CSL105: Discrete Mathematical Structures

You might also like