Download presentation
Presentation is loading. Please wait.
Published bySara Garrison Modified over 8 years ago
1
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1
2
Integers and Division Konstantin Busch - LSU2 divides : Examples: Integers factor
3
Konstantin Busch - LSU3 Number of positive integers divisible by and not exceeding :
4
Konstantin Busch - LSU4 integers if then
5
Konstantin Busch - LSU5 integers if and then
6
Konstantin Busch - LSU6 integers if and then
7
Konstantin Busch - LSU7 integers if and then
8
Konstantin Busch - LSU8 The division “algorithm” There are unique such that: divisor quotientremainder
9
Konstantin Busch - LSU9 Examples:
10
Konstantin Busch - LSU10 Division_algorithm( ) { while ( ) { } if ( and ) { } return, } //a is negative //adjust r //adjust q
11
Konstantin Busch - LSU11 Time complexity of division alg.: There is a better algorithm: (based on binary search)
12
“ is congruent to modulo ” Konstantin Busch - LSU12 Modular Arithmetic Examples:
13
Konstantin Busch - LSU13 Equivalent definitions
14
Konstantin Busch - LSU14 3 Length of line represents number
15
Konstantin Busch - LSU15 11 Length of helix line represents number
16
Konstantin Busch - LSU16 19 Length of helix line represents number
17
Konstantin Busch - LSU17 3 1119 Helix lines terminate in same number
18
Konstantin Busch - LSU18 Congruence class of modulo : There are congruence classes:
19
Konstantin Busch - LSU19
20
Konstantin Busch - LSU20
21
Konstantin Busch - LSU21
22
Konstantin Busch - LSU22 Follows from previous results by using:
23
Konstantin Busch - LSU23 Modular exponentiation Compute efficiently using small numbers Binary expansion of
24
Konstantin Busch - LSU24 Example:
25
Konstantin Busch - LSU25 Compute all the powers of 3 efficiently Use the powers of 3 to get result efficiently
26
Konstantin Busch - LSU26 Modular_Exponentiation( ) { for to { if ( ) } return } Time complexity: bit operations
27
Konstantin Busch - LSU27 Congruent application: Hashing functions Example: Employer idFolder# collision
28
Konstantin Busch - LSU28 Application: Pseudorandom numbers Linear congruential method: Sequence of pseudorandom numbers seed Example: 3,7,8,6,1,2,0,4,5,3,7,8,6,1,2,0,4,5,3… seed
29
Konstantin Busch - LSU29 Application: Cryptology “MEET YOU IN THE PARK” “PHHW BRX LQ WKH SDUN” Shift cipher: Affine transformation: encryptiondecryption
30
Primes and Greatest Common Divisor Konstantin Busch - LSU30 Prime :Positive integer greater than 1, only positive factors are Non-prime = composite Primes:2,3,5,7,11,13,17,19,23,29,31,37,41,…
31
Konstantin Busch - LSU31 Fundamental theorem of arithmetic Every positive integer is either prime or a unique product of primes Examples: prime Prime factorization:
32
Konstantin Busch - LSU32 Theorem: If is composite then it has prime divisor Proof: is composite since otherwise From fundamental theorem of arithmetic is either prime or has a prime divisor End of Proof
33
Konstantin Busch - LSU33 Prime_factorization( ) { while ( and ) { if ( divides ) { is a factor of } else next prime after } return all prime factors found } //first prime
34
Konstantin Busch - LSU34 do not divide 7007 does not divide 143
35
Konstantin Busch - LSU35 Theorem:There are infinitely many primes Proof:Suppose finite primes Let If some prime Since impossible No prime dividesis prime Contradiction! (From fundamental theorem of arithmetic) End of Proof
36
Konstantin Busch - LSU36 Largest prime known (as of 2006) Mersenne primes have the form:
37
Konstantin Busch - LSU37 Prime number theorem The number of primes less or equal to approaches to:
38
Konstantin Busch - LSU38 Goldbach’s conjecture: Every integer is the sum of two primes Twin prime conjecture: There are infinitely many twin primes Twin primes differ by 2:
39
Konstantin Busch - LSU39 Greatest common divisor largest integer such that and Examples: Common divisors of 24, 36:1, 2, 3, 4, 6, 12 Common divisors of 17, 22:1
40
Konstantin Busch - LSU40 Trivial cases:
41
Konstantin Busch - LSU41 Theorem: If then Proof: Thus, and have the same set of common divisors End of proof
42
Konstantin Busch - LSU42 first zeroresult divisions remainder
43
Konstantin Busch - LSU43 result
44
Konstantin Busch - LSU44 Euclidian Algorithm gcd( ) { while ( ) { } return } Time complexity:divisions
45
and have no common factors in their prime factorization Konstantin Busch - LSU45 Relatively prime numbers If then are relatively prime Example: 21, 22 are relatively prime
46
Konstantin Busch - LSU46 Least common multiple smallest positive integer such that and Examples:
47
Applications of Number Theory Konstantin Busch - LSU47 Linear combination: if then there are such that Example:
48
Konstantin Busch - LSU48 The linear combination can be found by reversing the Euclidian algorithm steps
49
Konstantin Busch - LSU49 Linear congruences We want to solve the equation for
50
Konstantin Busch - LSU50 Inverse of :
51
Konstantin Busch - LSU51 If and are relatively prime then the inverse modulo exists Theorem: Proof: End of proof
52
Konstantin Busch - LSU52 Example: solve equation Inverse of 3:
53
Konstantin Busch - LSU53 Chinese remainder problem :pairwise relatively prime Has unique solution for modulo
54
Konstantin Busch - LSU54 Solution: :inverse of modulo
55
Konstantin Busch - LSU55 Explanation::inverse of modulo Similar for any
56
Konstantin Busch - LSU56 Example:
57
Konstantin Busch - LSU57 Solution is unique modulo, since for any other solution it holds iff
58
Konstantin Busch - LSU58 Application of Chinese remainder problem Perform arithmetic with large numbers using arithmetic modulo small numbers Example:relatively prime numbers Any number smaller than has unique representation
59
Konstantin Busch - LSU59 + We obtain this by using the Chinese remainder problem solution ++++
60
Konstantin Busch - LSU60 Fermat’s little theorem For any prime and integer not divisible by ( ): Example:
61
Konstantin Busch - LSU61 RSA cryptosystem “MEET YOU IN THE PARK” “9383772909383637467” encryptiondecryption Large primes are public keys are private keys
62
Konstantin Busch - LSU62 Message to encrypt: “STOP” Encryption example: Translate to equivalent numbers “18 19 14 15” Group into blocks of two numbers
63
Konstantin Busch - LSU63 “1819 1415” “2081 2182” Apply encryption function to each block Encrypted message:
64
Konstantin Busch - LSU 64 Message decryption :an original block of the message :respective encrypted block “1819 1415” “2081 2182” We want to find by knowing
65
Konstantin Busch - LSU65 :inverse of modulo Inverse exists because by definition of congruent
66
Konstantin Busch - LSU66
67
Konstantin Busch - LSU67 Very likely it holds (because is a large prime and is small) By Fermat’s little theorem
68
Konstantin Busch - LSU68
69
Konstantin Busch - LSU69 By symmetry, when replacing with : We showed: By the Chinese remainder problem:
70
Konstantin Busch - LSU70 We showed: In other words:
71
Konstantin Busch - LSU71 Decryption example: “2081 2182” It can be shown that: “1819 1415” “18 19 14 15” = “STOP”
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.