Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10
Module 3
Number Theory and Modular Arithmetic
Primality Testing • Primality testing is the process of determining whether a given number n is a prime number. A prime number is an integer greater than 1 that has no positive divisors other than 1 and itself. • Trial Division: The simplest method, checking divisibility by all integers up to √n • Based on Fermat's Little Theorem, it uses a random base a to check whether an−1≡1mod n. If not, n is composite. Fermat's Little Theorem • Fermat's Little Theorem states that if p is a prime number and a is an integer such that gcd(a,p)=1 then: • ap−1≡ 1mod p Implications: • This theorem is useful in modular exponentiation and cryptography, particularly in RSA encryption. • It's also the basis for the Fermat primality test. Euler's Theorem • Euler's Theorem is a generalization of Fermat's Little Theorem. It states that if n is a positive integer and a is an integer such that gcd(a,n)=1, then: a^ϕ(n)≡1mod n Where ϕ(n) is Euler's totient function, which counts the number of integers less than n that are coprime to n. • Applications: • Euler’s theorem is fundamental in cryptography, especially in the RSA algorithm. • It helps in finding modular inverses and understanding the structure of multiplicative groups modulo nnn. Order of a Number • The order of a number a modulo n is the smallest positive integer k such that: • a^k≡1mod n Properties: • The order of a divides ϕ(n). • If a has order k modulo n, then a^j≡1mod n if and only if k divides j. • Applications: • Understanding the order of elements is essential in the study of cyclic groups and cryptographic algorithms like Diffie-Hellman key exchange. Primitive Roots • A primitive root modulo n is an integer g such that the order of g modulo n is ϕ(n). In other words, g generates all numbers coprime to n under multiplication modulo n. • Properties: • Not every integer n has a primitive root. Primitive roots exist for n=2,4,p^k, and 2p^k where p is an odd prime. • If g is a primitive root modulo n, then every integer coprime to n is congruent to some power of g. • Applications: • Primitive roots are crucial in number theory and are used in cryptographic protocols such as the Diffie-Hellman key exchange. Euclidean Algorithm • The Euclidean algorithm is a method for finding the greatest common divisor (GCD) of two integers a and b. It is based on the principle that gcd(a,b)=gcd(b,amod b), and the algorithm repeatedly applies this principle until b=0. Steps: • Start with two integers a and b. • Replace a with b and b with a mod b. • Repeat the process until b=0. The GCD is the last non-zero remainder. Example on Euclidean Algorithm Extended Euclidean Algorithm • The Extended Euclidean Algorithm is an extension of the Euclidean Algorithm that not only finds the GCD of two integers aaa and bbb, but also expresses the GCD as a linear combination of aaa and bbb: gcd(a,b)=ax+by Steps: • Perform the Euclidean algorithm to find the GCD. • Work backwards to express the GCD as a linear combination of a and b. Applications: • Finding modular inverses in cryptography. Examples • Find the greatest common divisor (GCD) of a=252 and b=105 using the Euclidean Algorithm. • Steps: • Initial Step: • a=252, b=105 • Divide a by b and find the remainder: 252÷105=2 with a remainder of 42 • Replace a with b and b with the remainder: gcd(252,105)= gcd(105, 42) • Gcd(105,42) = gcd (42,21) • Gcd(42,21)=0 • Hence gcd(252,105) = 21 (last non zero remainder)