ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ ΤΜΗΜΑ ΗΛΕΚΤΡΟΛΟΓΩΝ ΜΗΧΑΝΙΚΩΝ ΚΑΙ ΜΗΧΑΝΙΚΩΝ ΥΠΟΛΟΓΙΣΤΩΝ ΗΜΥ Διακριτή Ανάλυση και Δομές Χειμερινό Εξάμηνο 6 Σειρά Ασκήσεων Ακέραιοι και Διαίρεση, Πρώτοι Αριθμοί, GCD/LC, Συστήματα Ταύτισης Eercise Problem..7 The given condition mens tht bc= (c)t for some integer t. Since c, we cn divide both sides b c to obtin b = t. This is the definition of b, s desired. Problem.. (optionl) In ech cse we merel hve to compute the epression on the right mod. This mens dividing it b nd ting the (nonnegtive) reminder. ) 9 mod = 6 mod = b) b) 9 mod = 99 mod = 8 c) + 9 mod = mod = d) + 9 mod = 5 mod = 9 e) + 9 mod = 97 mod = 6 f) - 9 mod = -665 mod = (becuse -665 = -5 + ) Problem..7 ) To show tht this conditionl sttement does not necessril hold, we need to find n emple in which c =bc (mod m), but b (mod m). Let m = nd c = (wht is importnt in constructing this emple is tht m nd c hve nontrivil common fctor). Let = nd b =. Then c = nd bc =, so c =bc (mod ), but (mod ).
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ b) To show tht this conditionl sttement does not necessril hold, we need to find n emple in which = b (mod m) nd c = d (mod m), but c b d (mod m). If we tr few rndoml chosen positive integers, we will esil find counteremple. Let m = 5, =, b =, c =, nd d = 6. Then c = nd b d = 79 = (mod 5), so 6 (mod 5), even though = (mod 5) nd = 6 (mod 5). Problem..5 (optionl) In ech cse we follow the ide of converting ech octl digit to its binr equivlent (including leding 's where necessr). Note tht b convention we then group the binr digits into groups of fours, strting t the right. ) Since (5) 8 = (), (7) 8 = (lll), nd () 8 = (), we hve (57) 8 = ( ). b) We conctente,,, nd to obtin ( ). c) ( ) d) ( ) Problem..7 We simpl write the binr equivlents of ech digit (A) 6 = (), (B) 6 = (), (C) 6 = (), (D) 6 = (), (E) 6 = (), nd (F) 6 = (). Note tht the blocing b groups of four binr digits is just for redbilit b humns. ) (8E) 6 = ( ) b) (5AB) 6 = ( ) c) (ABBA) 6 = ( ) d) (DEFACED) 6 = ( ) Problem..5! = 5 6 7 8 9 = 5 ( ) 7 ( 5) = 8 5 7
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ Problem..5 The prime fctors of re,, nd 5. Thus we re looing for positive integers less thn tht hve none of these s prime fctors. Since the smllest prime number other thn these is 7, nd 7 is lred greter thn, in fct onl primes (nd the number ) will stisf this condition. Therefore the nswer is, 7,,, 7, 9,, nd 9. Problem..5 ) Following the procedure of Emple, we crr out the Eucliden lgorithm to find gcd(, 9) 9= + = Then we wor bcwrds to rewrite the gcd (the lst nonzero reminder, which is here) in terms of nd 9 =9- Therefore the Bezout coefficients of 9 nd re nd -, respectivel. The coefficient of is our desired nswer, nmel -, which is the sme s 7 modulo 9. b) We proceed s bove =7 9 + 8 9 = 8 + 8= + = + = Then we wor bcwrds to rewrite the gcd (the lst nonzero reminder, which is here) in terms of nd 9 =- = - (8 - ) = - 8
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ = (9-8) - 8 = 9-7 8 = 9-7 ( - 7 9) = (-7) +5 9 Therefore the Bezout coefficient of 9 is 5, nd tht is n inverse of 9 modulo. c) We proceed s bove 89 = 55 + 55 = + = + = + 8 = 8 + 5 8= 5+ 5= + = + = Then we wor bcwrds to rewrite the gcd (the lst nonzero reminder, which is here) in terms of 89 nd 55 =- = - (5 - ) = - 5 = (8-5) - 5 = 8-5 =. 8 - ( - 8) = 5 8 -. = 5 ( - ) - = 5-8 = 5-8 ( - ) = - 8 = (55 - ) - 8 = 55 - = 55 - (89-55) = 55-89 Therefore the Bezout coefficient of 55 is, nd tht is n inverse of 55 modulo 89.
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ d) We proceed s bove = 89 + 5 89 = 5 + 5 5 = 5 + 9 5 = 9 + 6 9 = 6 + 6=5 + = Then we wor bcwrds to rewrite the gcd (the lst nonzero reminder, which is here) in terms of nd 89 =6-5 = 6-5 (9-6) = 6 6-5 9 = 6 (5-9) - 5 9 = 6 5-9 = 6 5 - (5-5) = 7 5-5 = 7 (89-5) - 5 = 7 89-8 5 = 7 89-8 ( - 89) = 7 89-8 Therefore the Bezout coefficient of 89 is 7, nd tht is n inverse of 89 modulo. 5
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ Problem.. (optionl) We follow the hint. Adding 6 to both sides gives the equivlent congruence 5 + 9 + 6 = (mod ), becuse 5 + 6 = = (mod ). This fctors s (5 + )( + ) = (mod ). Becuse there re no non-zero divisors of woring modulo, we conclude tht the solutions re precisel the solutions of 5 + = (mod ) nd + = (mod ). B inspection (tril-nd-error) or woring it out through the Eucliden lgorithm nd bc-substituting, we find tht n inverse of 5 modulo is 9, nd multipling both sides of 5+ = (mod ) b 9 ields +7 = (mod ), so = -7 = 6 (mod ). Similrl, n inverse of modulo is, nd we get = -8 = (mod ). So the solution set is {, 6} (nd nthing congruent to these modulo ). Plugging these vlues into the originl eqution to chec, we hve 5 +9 + 6 = 98 = (mod ) nd 5 6 +9 6 + 6 = 66 = (mod ). Problem.5. (optionl) We re simpl sed to compute mod 97 for ech vlue of. We do this b dividing the given number b 97 nd ting the reminder, which cn be found either b multipling the deciml reminder b 97, or b subtrcting 97 times the quotient from. ) 56798 mod 97 = 9 b) 8 mod 97 = 57 c) 957 mod 97 = d) 987555 mod 97 = 5 6
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ Eercise {,6} {,76} {,799} GCD LC 7 7 77 7 Eercise {,5,9} {,7,,7} {,5,} {7,8,9,} Eercise (optionl) If mod m b mod m, then mod m q b mod m b q m r m r b ( q q ) m b mod m Eercise 5 () mod 7 mod 7 (6 ) mod 7 ( ) mod 7,6,,,6,,... similr 6 7
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ 8 Eercise 6 (optionl) ) (,..., (),,7,9 (), () Eercise 7 ) gcd(,7) (,) 7 (7,) gcd(,7) b) gcd(,) 99 (99,) 99 99 (,99) gcd(,99) c) gcd(77,) (,) 5 (5,) 5 9 (9,5) 5 9 (,9) 9 5 (,) 77 (77,) gcd(77,)
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ 9 Eercise 8 Vlid Therefore For n n n n ) mod... ( mod (mod ) mod, mod... Eercise 9 mod6 ) mod6 ( 6 ) ( 8 ) ( ) ( 8 6 6 8 8 6 6 ) ( ) ( ) ( n m n
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ Eercise, mod, mod, mod, mod, ( ) mod mod mod, Eercise 6, mod, mod, mod, mod, mod mod mod mod,
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ Eercise b b C mod b C b p p p ( b)( b) mod b mod p b p ή b mod p ( C p )( C mod p( p prime number) p Για τυχαίο S, με S=p p p i (p i prime number). Αν mod5= ⱻ p i ώστε p i => (p i ή p i ) με S prime number, S=p οπότε p ή p ) Eercise m Y, m π.χ.y,,, Y, m, Y 5, 5 mod δοκιμάζω (Y )mod Y ( 5 mod 6 Λύσεις,6, 6,...
ΗΜΥ ΔΙΑΚΡΙΤΗ ΑΝΑΛΥΣΗ ΚΑΙ ΔΟΜΕΣ Eercise (mod ) (mod ) (mod 5) (mod ) 5 65 5 5 66 5 5 mod 65mod, mod mod, mod 5 66mod 5, mod mod 8, ( ( ( (7 ) mod ) mod ) mod 5 ) mod 7 ( 65 66 7)mod