Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Abuse of notation wikipedia , lookup
Vincent's theorem wikipedia , lookup
History of logarithms wikipedia , lookup
Factorization wikipedia , lookup
Elementary mathematics wikipedia , lookup
Proofs of Fermat's little theorem wikipedia , lookup
Mathematics of radio engineering wikipedia , lookup
Factorization of polynomials over finite fields wikipedia , lookup
Please show your work! Thanks… a) Define the greatest common divisor of two integers. Let a and b be two integers . Then the greatest common divisor of a and b is defined as the largest positive integer k such that a and b are both divisible by k. Denoted by GCD(a,b). For instance, the gcd(2,4)=2 b) Describe at least three different ways to find the greatest common divisor of two integers. Method 1: Binary GCD GCD(a,b)=GCD{min(a,b), |a-b|} For instance, GCD(2,4)=GCD{min(2,4),|2-4|}=GCD(2,2)=2; Method 2. The Euclidean algorithm Given two natural numbers a and b, check if b is zero. If yes, a is the gcd. If not, repeat the process using b and the remainder after integer division of a and b (written a modulus b below). function gcd(a, b) if b = 0 return a else return gcd(b, a modulus b) This can be rewritten iteratively as: function gcd(a, b) while b ≠ 0 var t := b b := a modulus b a := t return a Method 3: Given two integers a and b. First, we can write a and b in the standard prime factorizations, namely, a p1 1 p2 2 ... pm m r r r and b q1 1 q2 2 ...qn n l l l where pi’s and qj’s are prime numbers. Then look at their factorizations and see the common factors which are the GCD. In detailed, look at each of those pi and qj such that pi=qj, then choose the smaller one. For instance, to find GCD(135, 60) 135 33 * 5 and 60 2 2 * 3 * 5 So, the common factor is 3*5=15 So, GCD(135, 60)=15 c) Find the greatest common divisor of 1,234,567 and 7,654,321. Use method 1. GCD(1234567 ; 7654321) =GCD(1234567 ; |7654321-1234567|) =GCD(1234567 ; 6419754) =GCD(1234567 ; |6419754-1234567|) =GCD(1234567 ; 5185187) =GCD(1234567 ; 3950620) =GCD(1234567 ; 2716053) =GCD(1234567 ; 1481486) =GCD(1234567 ; 246919) =GCD(246891; 246919) =GCD(246891; 28)=GCD(8817*28+15; 28) ………………(1) …………….. =GCD(15, 28)=1 ………………………..(2) Note: From (1) to (2), we have to repeat that process many times. Note that each time, the bigger number decreased by 28, so it is good to write 246891=8817*28+15. So, after 8817 steps, it reduces to (2). For (2), it is easy to see GCD(15,28)=1 since they don’t have a common factor other than 1. d) Find the greatest common divisor of 2335577911 and 2937557313. Use Method 3, we know that GCD(2335577911 ; 2937557313)= 23355573 Note: just look at each term, for instance, in the first one, there is a factor 23 and the second one contains 25. We choose the smaller one 23 Keep doing this, we find the largest common factor which is 23355573