A Fast Euclidean Algorithm for Gaussian Integers

Size: px
Start display at page:

Download "A Fast Euclidean Algorithm for Gaussian Integers"

Transcription

1 J. Symbolic Computation (2002) 33, doi: /jsco Available online at on A Fast Euclidean Algorithm for Gaussian Integers GEORGE E. COLLINS Department of Computer and Information Sciences, University of Delaware, Newark, DE 19716, U.S.A. A new version of the Euclidean algorithm is developed for computing the greatest common divisor of two Gaussian integers. It uses approximation to obtain a sequence of remainders of decreasing absolute values. The algorithm is compared with the new (1+i)- ary algorithm of Weilert and found to be somewhat faster if properly implemented. c 2002 Elsevier Science Ltd 1. Introduction We present a new algorithm for computing a greatest common divisor of any two non-zero Gaussian integers. It is Euclidean in the sense that it computes a sequence of quotients and remainders. It is approximative in the sense that it approximates the exact quotient of any two successive remainders, A i and A i+1, and then uses a nearest Gaussian integer, Q i, to that approximate quotient to compute the next remainder, A i+2 = A i Q i A i+1. The approximation is sufficiently accurate that one always has A i+2 < c A i+1 for some constant c < 1. We further improve this method by utilizing the fact that the quotients Q i are frequently so small that the product Q i A i+1 can be computed more quickly by addition and shifting. Without this improvement the method is somewhat slower than Weilert s (1 + i)-ary method, but with it it is somewhat faster. Recently Weilert (2000a) presented a new gcd algorithm for Gaussian integers, the (1 + i)-ary algorithm, that is analogous to the binary gcd algorithm for rational integers. In that paper he also briefly described an algorithm for Gaussian integers that he referred to as Lehmer-type. This algorithm was also an approximative Euclidean algorithm in the above sense. In a personal communication, Weilert explained that he called this algorithm Lehmer-type because it uses only leading parts of the operands to compute quotients. We would prefer to reserve the name Lehmer-type for algorithms that share the properties of Lehmer s method that the correct quotients are always computed and several small quotients are combined, as in Caviness and Collins (1976). Weilert presented experimental results showing the (1 + i)-ary algorithm to be about three times as fast as his Lehmer-type algorithm. In this paper we describe our approximative Euclidean algorithm in full detail and present experimental results showing it to be faster than Weilert reported for the (1 + i)-ary algorithm by a factor of about 1.6 and about 5.5 times as fast as Weilert s Lehmer-type algorithm. His Lehmer-type algorithm was not described in sufficient detail that we can explain this discrepancy. We have implemented both the (1 + i)-ary algorithm and our approximative Euclidean algorithm in the SACLIB computer algebra system. We describe both implementations in full detail to show how we have been able to make each algorithm very efficient. Our /02/ $35.00/0 c 2002 Elsevier Science Ltd

2 386 G. E. Collins implementation of the (1+i)-ary algorithm takes only about 80% of the time reported by Weilert for his implementation, and our implementation of our approximative Euclidean algorithm takes about 75% of the time taken by our implementation of the (1 + i)-ary algorithm. The length of any Gaussian integer A, denoted by L(A), is defined to be the maximum of the bit lengths of its real and imaginary parts. We define gcd(a, B) to be the unique greatest common divisor of A and B that is either real or in the first quadrant. We show that the computing time of our algorithm is dominated by m(m n + 1) + n(n k + 1), where m and n are the lengths of the inputs A and B, m n, and k is the length of C = gcd(a, B). We observe that the same is easy to prove for Weilert s algorithm. In Weilert (2000a) the computing time of the (1 + i)-ary algorithm is compared with that of the asymptotically faster descent method of Schönhage. Weilert finds that the (1 + i)-ary algorithm is faster for inputs of lengths up to about Referring to Weilert s table, we find that our approximative Euclidean algorithm is faster for lengths up to about See Weilert (2000b) for more about the descent method. In Section 2 we present the approximative Euclidean algorithm, prove its validity and analyze its computing time. In Section 3 we discuss our implementation in SACLIB of both the approximative Euclidean algorithm and the (1 + i)-ary algorithm, and compare their observed computing times. In Section 4 we present additional observations regarding the characteristics of both algorithms. 2. The Approximative Euclidean Algorithm Our algorithm is such that whenever we divide A by B with L(A) = m and L(B) = n, we have m n 1. A nearest Gaussian integer, Q, to the quotient A/B will have L(Q) approximately equal to m n. For an arbitrary complex number x + yi, let {x + yi} = {x} + {y}i, where {x} is the nearest integer to the real number x (the one of least absolute value in case of a tie). Our algorithm uses a parameter d, a positive integer, to control the accuracy with which quotients of Gaussian integers are computed. Let µ = max(m n, 0). If µ + d n, let a = {A/2 n (µ+d) } and b = {B/2 n (µ+d) }; otherwise let a = A and b = B. a/b is then an approximation to A/B. We proceed to compute a/b in the usual way, dividing a conj(b) by norm(b), obtaining the rational complex number q. We then let Q = {q}. Q may not be the same as {A/B}, but if R = A QB and d is large enough, we will nevertheless have, for some positive c < 1, R < c B. We now proceed to prove a sequence of four theorems that will establish that d 8 suffices. Theorems 1 and 2 are used as lemmas in the proof of Theorem 3, which bounds the error in the quotient resulting from truncating A and B. Theorem 4 then uses Theorem 3 to bound the remainder R. Theorem 1. Let A and B be Gaussian integers, m and k integers, with m L(A) k and m L(B) k. Let Ā = A/2 k, B = B/2 k, Ã = {A/2 k } and B = {B/2 k }. Then re(ā B) re(ã B) < 2 m k+1 and im(ā B) im(ã B) < 2 m k+1. Proof. Let Ā = ā 1 + ā 2 i, B = b1 + b 2 i, Ã = ã 1 + ã 2 i, and B = b 1 + b 2 i. Then ā 1 b1 ã 1 b1 = (ā 1 ã 1 ) b 1 + ( b 1 b 1 )ã 1 ā 1 ã 1 b 1 + b 1 b 1 ã 1 (1/2) b 1 + (1/2) ã 1 < 2 m k since b 1 < 2 m k and ã 1 2 m k. Similarly ā 2 b2 ã 2 b2 < 2 m k. It then follows immediately that re(ā B) re(ã B) < 2 m k+1. The proof for the imaginary parts is similar.

3 A Fast Euclidean Algorithm 387 Theorem 2. Let a, ã, b and b be real numbers. Assume that b b δ b with δ 1/4. Then ã/ b a/b (4δ/3) a/b + (1 + 4δ/3) (ã a)/b. Proof. Let b = (1 δ 1 )b. Then δ 1 δ so ã/ b a/b = ã/((1 δ 1 )b) a/b = ã(1+δ 1 +δ 2 1/(1 δ 1 ))/b a/b = (δ 1 +δ 2 1/(1 δ 1 ))a/b+(1+δ 1 +δ 2 1/(1 δ 1 ))(ã a)/b (δ 1 +δ 2 1/(1 δ 1 ))a/b + (1+δ 1 +δ 2 1/(1 δ 1 ))(ã a)/b (4δ/3) a/b +(1+4δ/3) (ã a)/b since δ 1 + δ 2 1/(1 δ 1 ) = δ 1 /(1 δ 1 ) δ/(1 δ) 4δ/3. Henceforth let m = L(A) and n = L(B). In the following theorems we will assume that m n 1. If A and B are the two inputs to our algorithm and L(A) < L(B), we interchange A and B so that m n. Then we compute a sequence of remainders A 1, A 2,..., A r with A 1 = A, A 2 = B, A r = 0, A i+2 = A i Q i A i+1, Q i a Gaussian integer for 1 i r 2, and A i+1 < A i for i 2, so that A r 1 is a gcd of A and B. From A i+1 < A i it follows easily that L(A i ) L(A i+1 ) 1. Theorem 3. Let A and B be Gaussian integers with L(A) = m, L(B) = n, m n 1, d 6, µ = max(m n, 0) and k = n (µ + d). Let à = {A/2 k }, B = {B/2 k }. Then re(ã/ B) re(a/b) < d+4 and im(ã/ B) im(a/b) < d+4. Proof. Let Ā = A/2k, B = B/2 k. Let a = re(ā conj( B)), ã = re(ã conj( B)), b = norm( B), b = norm( B). Then a/b = re(a/b) and ã/ b = re(ã/ B). By Theorem 1, since L(B) = n m + 1, ã a < 2 m k+2 and b b < 2 n k+1. Next we will apply Theorem 2. Let δ = b b /b. B 2 n 1 so B 2 n k 1. Therefore b 2 2n 2k 2 and b b /b < 2 n k+1 /2 2n 2k 2 = 2 n+k+3 = 2 n+(n µ d)+3 = 2 µ d+3 2 d+3 1/8. a/b = re(a/b) A/B = A / B < 2 m+1/2 /2 n 1 = 2 m n+3/2 2 µ+3/2. So (4δ/3) a/b (4/3)2 µ d+3 2 µ+3/2 = (4/3)2 d+9/2. Since δ 1/8, 1 + 4δ/ /6. Therefore ã a /b < 2 m k+2 /2 2n 2k 2 = 2 m 2n+k+4 = 2 (m n) (n k)+4 2 µ (µ+d)+4 = 2 d+4. Also (1 + 4δ/3) ã a /b (7/6)2 d+4. Therefore, by Theorem 2, ã/ b a/b (4/3)2 d+9/2 + (7/6)2 d+4 = (4 2/3 + 7/6)2 d+4 < d+4. The proof for the imaginary parts is identical. Theorem 4. Assume the hypotheses of Theorem 3 and let d 8. Let Q = Ã/ B, Q = { Q}, R = A BQ. Then R B. Proof. Let Q = A/B. By Theorem 3, re(q) re( Q) < Also re( Q) re(q ) < 1/2. So re(q) re(q ) < 1/ Likewise im(q) im(q ) < 1/ Since R = A BQ = A BQ + B(Q Q ) = B(Q Q ), norm(r) < 2(1/ ) 2 norm(b) < norm(b). Theorem 5. Let m n k 1. For L(A) = m, L(B) = n and L(C) = k, where C is any gcd of A B. The computing time of the approximative Euclidean algorithm is dominated by m(m n + 1) + n(n k + 1). Proof. Let A 1 = A, A 2 = B, A i = A i+1 Q i + A i+2 for 1 i r, where Q 1,..., Q r are the quotients computed by the algorithm and A 3,..., A r+2 are the remainders. Let n i = L(A i ) and µ i = max(n i n i+1, 0). Let a i and a i+1 be the approximations to A i and A i+1, respectively. Then L(a 1 ) 2µ i + d and L(a i+1 ) µ i + d. It follows that the time to compute Q i is dominated by (µ i + 1) 2 and hence by n i (µ i + 1). The time to then

4 388 G. E. Collins multiply A i+1 by Q i is dominated by n i (µ i + 1). The time to subtract A i+1 Q i from A i is dominated by n i. Therefore the time for all three operations is dominated by n i (µ i + 1) and thus by n i (n i n i+1 + 1). Taking i = 1, the time to compute Q 1 and A 3 is dominated by m(m n + 1). The time to compute the remaining Q i s and the remaining R i s is dominated by r 2 n i(n i n i+1 + 1) n r 2 (n i n i+1 + 1) n(n k + r). But it is clear from Theorem 4 that r is dominated by n k + 1. So the total computing time for the algorithm is dominated by m(m n + 1) + n(n k + 1). We remark that it is not difficult to show that the computing time of Weilert s algorithm is also dominated by m(m n+1)+n(n k+1). Compare this with the time n(m k+1) that was derived in Collins (1974) for the Euclidean algorithm for ordinary integers. 3. Implementation and Performance We have implemented both the (1 + i)-ary algorithm and the approximative Euclidean algorithm in the SACLIB computer algebra system (version 2.1). As background for our subsequent presentation of experimentally observed computing times of both algorithms, we provide some important details about our implementations. We begin with the (1 + i)-ary algorithm. That algorithm first divides both inputs, A and B, by the largest possible powers of 1 + i. Then it repeats a loop in which, first, A and B are interchanged, if necessary, so that A B, approximately. Weilert does not specify exactly how his implementation achieves this. Our implementation does so by first computing k = L(A) L(B). If k > 1 then A > B and if k < 1 then A < B. Otherwise 10-bit approximations of the norms of A and B are used for the comparison. The next computation in the loop is to find the Gaussian integer unit ɛ that minimizes A ɛb, if now A > B. Here again approximation is permissible. In our implementation, we first determine the quadrant and half-quadrant of both A and B. Quadrants are determined from the signs of the real and imaginary parts, and half-quadrants are then determined by comparing the magnitudes of the real and imaginary parts. If ɛ is the unit such that A and ɛb are in opposite quadrants, and if, moreover, A and ɛb are in opposite half-quadrants, then ɛ is the desired unit. Otherwise an approximate norm comparison for two competing units is required, again with 10-bit approximations. A ɛb is then divisible by 1 + i, and it is divided by the largest possible power of 1 + i. This is accomplished as follows. If 2 k is the largest power of 2 that divides A ɛb then (1+i) 2k+1 is the largest power of 1 + i that divides A ɛb since (1 + i) 2 = 2i. The division is performed by multiplying by 1 i, using additions and subtractions, then dividing by 2 k+1, using shifting. Thus the (1 + i)-ary method never requires multiplying a multi-precision integer by a single-precision integer as in the approximative Euclidean method. In our implementation of both algorithms, the real and imaginary parts of all Gaussian integers are stored in arrays. The first word of such an array contains the length of the integer in words, and the second word of the array contains the sign of the integer. Each subsequent word of the array contains 29 bits of the integer, for consistency with other parts of SACLIB. Two features of the implementation of our Euclidean algorithm are important. First, in computing approximate quotients, if 3µ + 2d 29 then all required arithmetic involves operands of at most 31 bits and thus can be performed with hardware arithmetic. So we treat this as a special case, without the use of arrays or software arithmetic. Second, many of the approximate nearest quotients are very small.

5 A Fast Euclidean Algorithm 389 Table 1. Inputs of equal bit lengths n. (1 + i)-ary (1 + i)-ary Euclidean Euclidean n (TP) (SACLIB) (add/shift) If the real or imaginary part of any quotient is less than or equal to 4 in absolute value, we perform the multiplication of the divisor by this integer by addition and/or shifting. We have observed that this accounts for more than 90% of all multiplications, and that this feature decreases the total computing time of the algorithm by about 52%. Table 1 shows the computing times in milliseconds for the (1+i)-ary algorithm and for the approximative Euclidean algorithm for inputs of various bit lengths n. The column (1 + i)-ary (TP) shows the times reported by Weilert for his TP implementation of the (1 + i)-ary algorithm. Weilert reported the time in Mtu s and we have converted them to milliseconds using his conversion factor of 300 Mtu s per second. Weilert used an Intel Pentium II running at 400 MHz; our SACLIB programs were run on a SUN4U/400 Ultra-450 operating at 400 MHz. The column (1 + i)-ary (SACLIB) shows the times for our SACLIB implementation of the (1 + i)-ary method. The column Euclidean shows the times for our implementation of the approximative Euclidean algorithm when all multiplications are performed without adding and shifting. The column Euclidean (add/shift) shows the times when adding and shifting are used for integer multipliers less than or equal to 4. The real and imaginary parts of the inputs were generated as random n-bit integers. In our program for the approximative Euclidean algorithm, d is a parameter, which we have set to 8 for our timings. However, we have observed that increasing d to as much as 12 makes very little difference in its computing time. Also, although we have only proved its validity for d 8, we have not observed any faulty performance for d as small as 3. Perhaps a more careful analysis could prove validity for some value of d less than 8. However, we have also not observed any decrease in computing time when using values of d that are smaller than 8. This table shows that for very large inputs our implementation of the (1 + i)-ary algorithm takes about 80% of the time taken by Weilert s TP implementation, that the use of addition and shifting for multiplications by small integers saves about 52% of the time in the Euclidean algorithm, and that for large integers the Euclidean algorithm, with adding and shifting, takes about 75% of the time taken by our implementation of the (1 + i)-ary algorithm. We have found that when one input is significantly longer than the other, the Euclidean algorithm gains a somewhat stronger advantage. Table 2 shows the computing times when the bit lengths of the inputs are n and 2n. Here the times for the approximative Euclidean algorithm are about 30% of those for the (1 + i)-ary algorithm. 4. Further Observations It is to be expected that the approximative Euclidean algorithm does not always compute a nearest quotient and least remainder. We wanted to know how frequently the

6 390 G. E. Collins Table 2. Inputs of unequal lengths. (1 + i)-ary Euclidean n (SACLIB) (add/shift) Table 3. Numbers of deviant quotients and numbers of divisions. d = 8 d = 7 d = 6 d = 5 d = 4 d = computed quotient failed to be nearest, and how this would affect the number of divisions. Rolletschek (1986) proved that if each remainder is minimal (equivalently, each quotient is nearest) then the number of divisions is minimal. The converse is easily seen to be false by example. Let 4 + 4i and 2 + 3i be the two inputs. The least remainder sequence is 4 + 4i, 2 + 3i, 2 + i, 1 with quotients q 1 = 1 and q 2 = 1 + i. If we change the first quotient to q 1 = 2 we obtain the remainder sequence 4 + 4i, 2 + 3i, 2i, i with q 2 = 1 + i. q 1 is not nearest since (4 + 4i)/(2 + 3i) = (20 4i)/13, but the number of divisions is three in each case. We generated 10 pairs of Gaussian integers with real and imaginary parts each consisting of 1000 random bits. For each of the pairs we counted the number of divisions in a minimal remainder sequence. Then we constructed a variant of our program for the approximative Euclidean algorithm that also computed a nearest quotient at each division step, and counted the number of times that the approximate Gaussian integer quotient differed from the nearest quotient. We ran this variant program for each of the 10 input pairs, and for values of the parameter d = 8, 7, 6, 5, 4, 3. Table 3 displays, for each value of d, the numbers of deviant approximated quotients and the number of divisions. The numbers of divisions shown for d = 8 and 7 are the same as those for a minimal remainder sequence. Although we have not proved that the algorithm will always terminate with d < 8, it is remarkable that the method tolerates many incorrect quotients with little or no increase in the number of divisions. This variant program also compared the norm of each remainder with the norm of the divisor. For d 4 the norm of the remainder never equaled or exceeded the norm of the divisor. For r = 3 it did so in just two cases. We experimentally determined the average number of iterations of the main loop required by each of the two algorithms, as a function of the number of bits in two inputs

7 A Fast Euclidean Algorithm 391 Table 4. Small integer quotient probabilities. j Percentage >4 8.5 Table 5. First quadrant quotient frequencies i i i i i i of equal lengths. We generated 10 pairs of Gaussian integers whose real and imaginary parts were random bit integers, and counted the number of iterations for each of the 10 algorithm executions. For Weilert s algorithm the average was , or about iterations per bit. For the approximative Euclidean algorithm the average was 6316, or about iterations per bit, which is 55% as many as for Weilert s algorithm. It is interesting to compare the average for the approximative Euclidean algorithm, presumably the same as the number for the Gaussian integer least remainder algorithm, with the number of iterations for the integer least remainder algorithm. The latter (Knuth, 1997), is approximately iterations per bit, so the ratio is 0.632/0.405 = Similarly, we might wish to compare the number of iterations for Weilert s algorithm with the number for the binary algorithm for ordinary integers. According to Knuth (1997) the latter is approximately 0.71, and the ratio in this case is 1.149/0.71 = Thus the ratio for the two kinds of Gaussian integer gcd algorithms is nearly the same as for the two kinds of integer gcd algorithms, namely about 1.6. Also, the number of iterations per bit is about 1.6 times as large for the Gaussian integer least remainder algorithm as for the integer least remainder algorithm, and the number of iterations for Weilert s Gaussian integer gcd algorithm is also about 1.6 times as large as for the binary gcd algorithm for integers. As noted in Section 3, our approximative Euclidean algorithm capitalizes on the very small size of most quotients, avoiding many multiplications. Table 4 shows the experimentally observed percentage of real and imaginary parts, counted separately, of integer quotients having the value k, k {0, 1, 2, 3, 4}, and k > 4. The table clearly demonstrates the importance of this feature. The first quadrant associate of a non-zero Guassian integer is the associate that is either real or in the first quadrant. Applying the approximative Euclidean algorithm to two random Gaussian integers of lengths , we computed the first quadrant associate of each quotient that was computed. Table 5 shows the frequency, expressed as a percentage, of each first quadrant quotient a + bi such that a, b 5.

8 392 G. E. Collins Acknowledgements I wish to thank the referees for useful criticisms and suggestions. This work was partially supported by NSF Grant CCR References Caviness, B. F., Collins, G. E. (1976). Algorithms for Gaussian integer arithmetic. In Jenks, R. D. ed., Proceedings of 1976 ACM Symposium on Symbolic and Algebraic Computation (SYMSAC 76), pp New York, ACM Press. Collins, G. E. (1974). The computing time of the Euclidean algorithm. SIAM J. Comput., 3, Knuth, D. E. (1997). The Art of Computer Programming, 3 rd edn, volume 2, Seminumerical Algorithms, Reading, MA, Addison-Wesley. Rolletschek, H. (1986). On the number of divisions of the Euclidean algorithm applied to Gaussian integers. J. Symb. Comput., 2, Weilert, A. (2000). (1 + i)-ary GCD computation in Z[i] as an analogue to the binary GCD algorithm. J. Symb. Comput., 30, Weilert, A. (2000). Asymptotically fast GCD computation in Z[i]. In Bosma, W. ed., Proceedings of the Fourth International Number Theory Symposium ANTS IV (Leiden, The Netherlands, July 2 7, 2000), LNCS 1838, pp Berlin, Springer. Received 10 May 2001 Accepted 9 November 2001

Ch 4.2 Divisibility Properties

Ch 4.2 Divisibility Properties Ch 4.2 Divisibility Properties - Prime numbers and composite numbers - Procedure for determining whether or not a positive integer is a prime - GCF: procedure for finding gcf (Euclidean Algorithm) - Definition:

More information

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013 Fall 2013 Student Responsibilities Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Proof Worksheets Attendance: Strongly Encouraged Overview 3.6 Integers and Algorithms 3.7

More information

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd() Student Responsibilities Week 8 Mat 2345 Week 8 Reading: Textbook, Section 3.7, 4.1, & 5.2 Assignments: Sections 3.6, 3.7, 4.1 Induction Proof Worksheets Attendance: Strongly Encouraged Fall 2013 Week

More information

The Euclidean Algorithm and Multiplicative Inverses

The Euclidean Algorithm and Multiplicative Inverses 1 The Euclidean Algorithm and Multiplicative Inverses Lecture notes for Access 2009 The Euclidean Algorithm is a set of instructions for finding the greatest common divisor of any two positive integers.

More information

Numbers. Çetin Kaya Koç Winter / 18

Numbers. Çetin Kaya Koç   Winter / 18 Çetin Kaya Koç http://koclab.cs.ucsb.edu Winter 2016 1 / 18 Number Systems and Sets We represent the set of integers as Z = {..., 3, 2, 1,0,1,2,3,...} We denote the set of positive integers modulo n as

More information

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24 Direct Proof MAT231 Transition to Higher Mathematics Fall 2014 MAT231 (Transition to Higher Math) Direct Proof Fall 2014 1 / 24 Outline 1 Overview of Proof 2 Theorems 3 Definitions 4 Direct Proof 5 Using

More information

2. THE EUCLIDEAN ALGORITHM More ring essentials

2. THE EUCLIDEAN ALGORITHM More ring essentials 2. THE EUCLIDEAN ALGORITHM More ring essentials In this chapter: rings R commutative with 1. An element b R divides a R, or b is a divisor of a, or a is divisible by b, or a is a multiple of b, if there

More information

Remainders. We learned how to multiply and divide in elementary

Remainders. We learned how to multiply and divide in elementary Remainders We learned how to multiply and divide in elementary school. As adults we perform division mostly by pressing the key on a calculator. This key supplies the quotient. In numerical analysis and

More information

Worst-case analysis of Weber s GCD algorithm

Worst-case analysis of Weber s GCD algorithm Information Processing Letters 72 (1999) 125 130 Worst-case analysis of Weber s GCD algorithm Christian Lavault, S. Mohamed Sedjelmaci LIPN, Université Paris-Nord, 93430 Villetaneuse, France Received 30

More information

Arbitrary-Precision Division

Arbitrary-Precision Division Arbitrary-Precision Division Rod Howell Kansas State University September 8, 000 This paper presents an algorithm for arbitrary-precision division and shows its worst-case time compleity to be related

More information

Answers (1) A) 36 = - - = Now, we can divide the numbers as shown below. For example : 4 = 2, 2 4 = -2, -2-4 = -2, 2-4 = 2.

Answers (1) A) 36 = - - = Now, we can divide the numbers as shown below. For example : 4 = 2, 2 4 = -2, -2-4 = -2, 2-4 = 2. Answers (1) A) 36 We can divide the two numbers by using the following steps : 1. Firstly, we will divide the mathematical signs of the numbers. We place a negative sign before the negative numbers and

More information

CPSC 467: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 9 September 30, 2015 CPSC 467, Lecture 9 1/47 Fast Exponentiation Algorithms Number Theory Needed for RSA Elementary Number Theory

More information

Finite Fields: An introduction through exercises Jonathan Buss Spring 2014

Finite Fields: An introduction through exercises Jonathan Buss Spring 2014 Finite Fields: An introduction through exercises Jonathan Buss Spring 2014 A typical course in abstract algebra starts with groups, and then moves on to rings, vector spaces, fields, etc. This sequence

More information

4 Powers of an Element; Cyclic Groups

4 Powers of an Element; Cyclic Groups 4 Powers of an Element; Cyclic Groups Notation When considering an abstract group (G, ), we will often simplify notation as follows x y will be expressed as xy (x y) z will be expressed as xyz x (y z)

More information

A p-adic Euclidean Algorithm

A p-adic Euclidean Algorithm A p-adic Euclidean Algorithm Cortney Lager Winona State University October 0, 009 Introduction The rational numbers can be completed with respect to the standard absolute value and this produces the real

More information

Polynomial multiplication and division using heap.

Polynomial multiplication and division using heap. Polynomial multiplication and division using heap. Michael Monagan and Roman Pearce Department of Mathematics, Simon Fraser University. Abstract We report on new code for sparse multivariate polynomial

More information

The set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, }

The set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, } Integers and Division 1 The Integers and Division This area of discrete mathematics belongs to the area of Number Theory. Some applications of the concepts in this section include generating pseudorandom

More information

Algorithms (II) Yu Yu. Shanghai Jiaotong University

Algorithms (II) Yu Yu. Shanghai Jiaotong University Algorithms (II) Yu Yu Shanghai Jiaotong University Chapter 1. Algorithms with Numbers Two seemingly similar problems Factoring: Given a number N, express it as a product of its prime factors. Primality:

More information

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I Diophantine equations are equations intended to be solved in the integers. We re going to focus on Linear Diophantine Equations.

More information

3 The fundamentals: Algorithms, the integers, and matrices

3 The fundamentals: Algorithms, the integers, and matrices 3 The fundamentals: Algorithms, the integers, and matrices 3.4 The integers and division This section introduces the basics of number theory number theory is the part of mathematics involving integers

More information

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook) Proofs Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm Reading (Epp s textbook) 4.3 4.8 1 Divisibility The notation d n is read d divides n. Symbolically,

More information

NOTES ON SIMPLE NUMBER THEORY

NOTES ON SIMPLE NUMBER THEORY NOTES ON SIMPLE NUMBER THEORY DAMIEN PITMAN 1. Definitions & Theorems Definition: We say d divides m iff d is positive integer and m is an integer and there is an integer q such that m = dq. In this case,

More information

Intermediate Math Circles February 26, 2014 Diophantine Equations I

Intermediate Math Circles February 26, 2014 Diophantine Equations I Intermediate Math Circles February 26, 2014 Diophantine Equations I 1. An introduction to Diophantine equations A Diophantine equation is a polynomial equation that is intended to be solved over the integers.

More information

On a Parallel Lehmer-Euclid GCD Algorithm

On a Parallel Lehmer-Euclid GCD Algorithm On a Parallel Lehmer-Euclid GCD Algorithm Sidi Mohammed Sedjelmaci LIPN CNRS UPRES-A 7030, Université Paris-Nord 93430 Villetaneuse, France. e-mail: sms@lipn.univ-paris13.fr ABSTRACT A new version of Euclid

More information

A New Algorithm and Refined Bounds for Extended Gcd Computation

A New Algorithm and Refined Bounds for Extended Gcd Computation A New Algorithm and Refined Bounds for Extended Gcd Computation David Ford* and George Havas** Department of Computer Science, Concordia University, Montrfial, Qufibec, Canada H3G 1M8 and Department of

More information

Definition For a set F, a polynomial over F with variable x is of the form

Definition For a set F, a polynomial over F with variable x is of the form *6. Polynomials Definition For a set F, a polynomial over F with variable x is of the form a n x n + a n 1 x n 1 + a n 2 x n 2 +... + a 1 x + a 0, where a n, a n 1,..., a 1, a 0 F. The a i, 0 i n are the

More information

Modular numbers and Error Correcting Codes. Introduction. Modular Arithmetic.

Modular numbers and Error Correcting Codes. Introduction. Modular Arithmetic. Modular numbers and Error Correcting Codes Introduction Modular Arithmetic Finite fields n-space over a finite field Error correcting codes Exercises Introduction. Data transmission is not normally perfect;

More information

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. 2 Arithmetic This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. (See [Houston, Chapters 27 & 28]) 2.1 Greatest common divisors Definition 2.16. If a, b are integers, we say

More information

Finite Fields. Mike Reiter

Finite Fields. Mike Reiter 1 Finite Fields Mike Reiter reiter@cs.unc.edu Based on Chapter 4 of: W. Stallings. Cryptography and Network Security, Principles and Practices. 3 rd Edition, 2003. Groups 2 A group G, is a set G of elements

More information

Parametric euclidean algorithm

Parametric euclidean algorithm Theoretical Mathematics & Applications, vol.3, no.3, 2013, 13-21 ISSN: 1792-9687 (print), 1792-9709 (online) Scienpress Ltd, 2013 Parametric euclidean algorithm Ali Ayad 1, Ali Fares 2 and Youssef Ayyad

More information

A number that can be written as, where p and q are integers and q Number.

A number that can be written as, where p and q are integers and q Number. RATIONAL NUMBERS 1.1 Definition of Rational Numbers: What are rational numbers? A number that can be written as, where p and q are integers and q Number. 0, is known as Rational Example:, 12, -18 etc.

More information

Warm-Up. Simplify the following terms:

Warm-Up. Simplify the following terms: Warm-Up Simplify the following terms: 81 40 20 i 3 i 16 i 82 TEST Our Ch. 9 Test will be on 5/29/14 Complex Number Operations Learning Targets Adding Complex Numbers Multiplying Complex Numbers Rules for

More information

M3P14 LECTURE NOTES 8: QUADRATIC RINGS AND EUCLIDEAN DOMAINS

M3P14 LECTURE NOTES 8: QUADRATIC RINGS AND EUCLIDEAN DOMAINS M3P14 LECTURE NOTES 8: QUADRATIC RINGS AND EUCLIDEAN DOMAINS 1. The Gaussian Integers Definition 1.1. The ring of Gaussian integers, denoted Z[i], is the subring of C consisting of all complex numbers

More information

Part I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS

Part I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS CS131 Part I, Number Systems CS131 Mathematics for Computer Scientists II Note 1 INTEGERS The set of all integers will be denoted by Z. So Z = {..., 2, 1, 0, 1, 2,...}. The decimal number system uses the

More information

CHAPTER 4: EXPLORING Z

CHAPTER 4: EXPLORING Z CHAPTER 4: EXPLORING Z MATH 378, CSUSM. SPRING 2009. AITKEN 1. Introduction In this chapter we continue the study of the ring Z. We begin with absolute values. The absolute value function Z N is the identity

More information

4 Number Theory and Cryptography

4 Number Theory and Cryptography 4 Number Theory and Cryptography 4.1 Divisibility and Modular Arithmetic This section introduces the basics of number theory number theory is the part of mathematics involving integers and their properties.

More information

Algorithms CMSC Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse

Algorithms CMSC Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse Algorithms CMSC-27200 Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse Instructor: László Babai Last updated 02-14-2015. Z denotes the set of integers. All variables in

More information

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635 COMP239: Mathematics for Computer Science II Prof. Chadi Assi assi@ciise.concordia.ca EV7.635 The Euclidean Algorithm The Euclidean Algorithm Finding the GCD of two numbers using prime factorization is

More information

EDULABZ INTERNATIONAL NUMBER SYSTEM

EDULABZ INTERNATIONAL NUMBER SYSTEM NUMBER SYSTEM 1. Find the product of the place value of 8 and the face value of 7 in the number 7801. Ans. Place value of 8 in 7801 = 800, Face value of 7 in 7801 = 7 Required product = 800 7 = 00. How

More information

Dividing Polynomials: Remainder and Factor Theorems

Dividing Polynomials: Remainder and Factor Theorems Dividing Polynomials: Remainder and Factor Theorems When we divide one polynomial by another, we obtain a quotient and a remainder. If the remainder is zero, then the divisor is a factor of the dividend.

More information

Quadratic Prime-Generating Polynomials Over the Gaussian Integers

Quadratic Prime-Generating Polynomials Over the Gaussian Integers Quadratic Prime-Generating Polynomials Over the Gaussian Integers Frank Fuentes Monta Meirose Erik R. Tou March 23, 2017 1 Introduction In 1772 [2], the Swiss mathematician Leonhard Euler discovered that

More information

New Minimal Weight Representations for Left-to-Right Window Methods

New Minimal Weight Representations for Left-to-Right Window Methods New Minimal Weight Representations for Left-to-Right Window Methods James A. Muir 1 and Douglas R. Stinson 2 1 Department of Combinatorics and Optimization 2 School of Computer Science University of Waterloo

More information

Contribution of Problems

Contribution of Problems Exam topics 1. Basic structures: sets, lists, functions (a) Sets { }: write all elements, or define by condition (b) Set operations: A B, A B, A\B, A c (c) Lists ( ): Cartesian product A B (d) Functions

More information

Distinguishing prime numbers from composite numbers: the state of the art. D. J. Bernstein University of Illinois at Chicago

Distinguishing prime numbers from composite numbers: the state of the art. D. J. Bernstein University of Illinois at Chicago Distinguishing prime numbers from composite numbers: the state of the art D. J. Bernstein University of Illinois at Chicago Is it easy to determine whether a given integer is prime? If easy means computable

More information

Efficient algorithms for gcd and cubic residuosity in the ring of Eisenstein integers

Efficient algorithms for gcd and cubic residuosity in the ring of Eisenstein integers Efficient algorithms for gcd and cubic residuosity in the ring of Eisenstein integers Ivan Bjerre Damgård and Gudmund Skovbjerg Frandsen BRICS Department of Computer Science University of Aarhus Ny Munkegade

More information

On Schönhage s algorithm and subquadratic integer gcd computation

On Schönhage s algorithm and subquadratic integer gcd computation On Schönhage s algorithm and subquadratic integer gcd computation Niels Möller April 12, 2005 Abstract We describe a hitherto unpublished subquadratic left-to-right gcd algorithm, discovered by Schönhage

More information

Elliptic Curves Spring 2013 Lecture #4 02/14/2013

Elliptic Curves Spring 2013 Lecture #4 02/14/2013 18.783 Elliptic Curves Spring 2013 Lecture #4 02/14/2013 4.1 Complexity of finite field arithmetic The table below summarizes the costs of various arithmetic operations. integers Z finite field F q addition/subtraction

More information

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime. PUTNAM TRAINING NUMBER THEORY (Last updated: December 11, 2017) Remark. This is a list of exercises on Number Theory. Miguel A. Lerma Exercises 1. Show that the sum of two consecutive primes is never twice

More information

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time. 8 Modular Arithmetic We introduce an operator mod. Let d be a positive integer. For c a nonnegative integer, the value c mod d is the remainder when c is divided by d. For example, c mod d = 0 if and only

More information

2WF15 - Discrete Mathematics 2 - Part 1. Algorithmic Number Theory

2WF15 - Discrete Mathematics 2 - Part 1. Algorithmic Number Theory 1 2WF15 - Discrete Mathematics 2 - Part 1 Algorithmic Number Theory Benne de Weger version 0.54, March 6, 2012 version 0.54, March 6, 2012 2WF15 - Discrete Mathematics 2 - Part 1 2 2WF15 - Discrete Mathematics

More information

not to be republished NCERT REAL NUMBERS CHAPTER 1 (A) Main Concepts and Results

not to be republished NCERT REAL NUMBERS CHAPTER 1 (A) Main Concepts and Results REAL NUMBERS CHAPTER 1 (A) Main Concepts and Results Euclid s Division Lemma : Given two positive integers a and b, there exist unique integers q and r satisfying a = bq + r, 0 r < b. Euclid s Division

More information

Some Facts from Number Theory

Some Facts from Number Theory Computer Science 52 Some Facts from Number Theory Fall Semester, 2014 These notes are adapted from a document that was prepared for a different course several years ago. They may be helpful as a summary

More information

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Solutions

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Solutions Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Solutions Warm-up Problems 1. What is a prime number? Give an example of an even prime number and an odd prime number. A prime number

More information

a + bi by sending α = a + bi to a 2 + b 2. To see properties (1) and (2), it helps to think of complex numbers in polar coordinates:

a + bi by sending α = a + bi to a 2 + b 2. To see properties (1) and (2), it helps to think of complex numbers in polar coordinates: 5. Types of domains It turns out that in number theory the fact that certain rings have unique factorisation has very strong arithmetic consequences. We first write down some definitions. Definition 5.1.

More information

Chapter 1. Greatest common divisor. 1.1 The division theorem. In the beginning, there are the natural numbers 0, 1, 2, 3, 4,...,

Chapter 1. Greatest common divisor. 1.1 The division theorem. In the beginning, there are the natural numbers 0, 1, 2, 3, 4,..., Chapter 1 Greatest common divisor 1.1 The division theorem In the beginning, there are the natural numbers 0, 1, 2, 3, 4,..., which constitute the set N. Addition and multiplication are binary operations

More information

Math Review. for the Quantitative Reasoning measure of the GRE General Test

Math Review. for the Quantitative Reasoning measure of the GRE General Test Math Review for the Quantitative Reasoning measure of the GRE General Test www.ets.org Overview This Math Review will familiarize you with the mathematical skills and concepts that are important for solving

More information

Number Theory and Graph Theory

Number Theory and Graph Theory 1 Number Theory and Graph Theory Chapter 1 Introduction and Divisibility By A. Satyanarayana Reddy Department of Mathematics Shiv Nadar University Uttar Pradesh, India E-mail: satya8118@gmail.com 1 DIVISION

More information

Fast Polynomial Multiplication

Fast Polynomial Multiplication Fast Polynomial Multiplication Marc Moreno Maza CS 9652, October 4, 2017 Plan Primitive roots of unity The discrete Fourier transform Convolution of polynomials The fast Fourier transform Fast convolution

More information

Mathematical Foundations of Public-Key Cryptography

Mathematical Foundations of Public-Key Cryptography Mathematical Foundations of Public-Key Cryptography Adam C. Champion and Dong Xuan CSE 4471: Information Security Material based on (Stallings, 2006) and (Paar and Pelzl, 2010) Outline Review: Basic Mathematical

More information

ECEN 5022 Cryptography

ECEN 5022 Cryptography Elementary Algebra and Number Theory University of Colorado Spring 2008 Divisibility, Primes Definition. N denotes the set {1, 2, 3,...} of natural numbers and Z denotes the set of integers {..., 2, 1,

More information

Topic Contents. Factoring Methods. Unit 3: Factoring Methods. Finding the square root of a number

Topic Contents. Factoring Methods. Unit 3: Factoring Methods. Finding the square root of a number Topic Contents Factoring Methods Unit 3 The smallest divisor of an integer The GCD of two numbers Generating prime numbers Computing prime factors of an integer Generating pseudo random numbers Raising

More information

(e) Commutativity: a b = b a. (f) Distributivity of times over plus: a (b + c) = a b + a c and (b + c) a = b a + c a.

(e) Commutativity: a b = b a. (f) Distributivity of times over plus: a (b + c) = a b + a c and (b + c) a = b a + c a. Math 299 Midterm 2 Review Nov 4, 2013 Midterm Exam 2: Thu Nov 7, in Recitation class 5:00 6:20pm, Wells A-201. Topics 1. Methods of proof (can be combined) (a) Direct proof (b) Proof by cases (c) Proof

More information

Module 1. Integers, Induction, and Recurrences

Module 1. Integers, Induction, and Recurrences Module 1. Integers, Induction, and Recurrences This module will look at The integers and the natural numbers. Division and divisors, greatest common divisors Methods of reasoning including proof by contradiction

More information

SUFFIX PROPERTY OF INVERSE MOD

SUFFIX PROPERTY OF INVERSE MOD IEEE TRANSACTIONS ON COMPUTERS, 2018 1 Algorithms for Inversion mod p k Çetin Kaya Koç, Fellow, IEEE, Abstract This paper describes and analyzes all existing algorithms for computing x = a 1 (mod p k )

More information

Euclidean Domains. Kevin James

Euclidean Domains. Kevin James Suppose that R is an integral domain. Any function N : R N {0} with N(0) = 0 is a norm. If N(a) > 0, a R \ {0 R }, then N is called a positive norm. Suppose that R is an integral domain. Any function N

More information

Number Theory A focused introduction

Number Theory A focused introduction Number Theory A focused introduction This is an explanation of RSA public key cryptography. We will start from first principles, but only the results that are needed to understand RSA are given. We begin

More information

ZEROS OF POLYNOMIAL FUNCTIONS ALL I HAVE TO KNOW ABOUT POLYNOMIAL FUNCTIONS

ZEROS OF POLYNOMIAL FUNCTIONS ALL I HAVE TO KNOW ABOUT POLYNOMIAL FUNCTIONS ZEROS OF POLYNOMIAL FUNCTIONS ALL I HAVE TO KNOW ABOUT POLYNOMIAL FUNCTIONS TOOLS IN FINDING ZEROS OF POLYNOMIAL FUNCTIONS Synthetic Division and Remainder Theorem (Compressed Synthetic Division) Fundamental

More information

Distinguishing prime numbers from composite numbers: the state of the art. D. J. Bernstein University of Illinois at Chicago

Distinguishing prime numbers from composite numbers: the state of the art. D. J. Bernstein University of Illinois at Chicago Distinguishing prime numbers from composite numbers: the state of the art D. J. Bernstein University of Illinois at Chicago Is it easy to determine whether a given integer is prime? If easy means computable

More information

An algorithm for the Jacobi symbol

An algorithm for the Jacobi symbol An O(M(n) log n) algorithm for the Jacobi symbol Richard P. Brent, ANU Paul Zimmermann, INRIA, Nancy 6 December 2010 Definitions The Legendre symbol (a p) is defined for a, p Z, where p is an odd prime.

More information

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Warm-up Problems 1. What is a prime number? Give an example of an even prime number and an odd prime number. (a) Circle the prime

More information

Fall 2017 Test II review problems

Fall 2017 Test II review problems Fall 2017 Test II review problems Dr. Holmes October 18, 2017 This is a quite miscellaneous grab bag of relevant problems from old tests. Some are certainly repeated. 1. Give the complete addition and

More information

Day 6: 6.4 Solving Polynomial Equations Warm Up: Factor. 1. x 2-2x x 2-9x x 2 + 6x + 5

Day 6: 6.4 Solving Polynomial Equations Warm Up: Factor. 1. x 2-2x x 2-9x x 2 + 6x + 5 Day 6: 6.4 Solving Polynomial Equations Warm Up: Factor. 1. x 2-2x - 15 2. x 2-9x + 14 3. x 2 + 6x + 5 Solving Equations by Factoring Recall the factoring pattern: Difference of Squares:...... Note: There

More information

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes. INTEGERS PETER MAYR (MATH 2001, CU BOULDER) In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes. 1. Divisibility Definition. Let a, b

More information

In-place Arithmetic for Univariate Polynomials over an Algebraic Number Field

In-place Arithmetic for Univariate Polynomials over an Algebraic Number Field In-place Arithmetic for Univariate Polynomials over an Algebraic Number Field Seyed Mohammad Mahdi Javadi 1, Michael Monagan 2 1 School of Computing Science, Simon Fraser University, Burnaby, B.C., V5A

More information

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology. MATH 501 Discrete Mathematics Lecture 6: Number theory Prof. Dr. Slim Abdennadher, slim.abdennadher@guc.edu.eg German University Cairo, Department of Media Engineering and Technology 1 Number theory Number

More information

RON M. ROTH * GADIEL SEROUSSI **

RON M. ROTH * GADIEL SEROUSSI ** ENCODING AND DECODING OF BCH CODES USING LIGHT AND SHORT CODEWORDS RON M. ROTH * AND GADIEL SEROUSSI ** ABSTRACT It is shown that every q-ary primitive BCH code of designed distance δ and sufficiently

More information

Exam 2 Review Chapters 4-5

Exam 2 Review Chapters 4-5 Math 365 Lecture Notes S. Nite 8/18/2012 Page 1 of 9 Integers and Number Theory Exam 2 Review Chapters 4-5 Divisibility Theorem 4-1 If d a, n I, then d (a n) Theorem 4-2 If d a, and d b, then d (a+b).

More information

Discrete Structures Lecture Primes and Greatest Common Divisor

Discrete Structures Lecture Primes and Greatest Common Divisor DEFINITION 1 EXAMPLE 1.1 EXAMPLE 1.2 An integer p greater than 1 is called prime if the only positive factors of p are 1 and p. A positive integer that is greater than 1 and is not prime is called composite.

More information

MATH FINAL EXAM REVIEW HINTS

MATH FINAL EXAM REVIEW HINTS MATH 109 - FINAL EXAM REVIEW HINTS Answer: Answer: 1. Cardinality (1) Let a < b be two real numbers and define f : (0, 1) (a, b) by f(t) = (1 t)a + tb. (a) Prove that f is a bijection. (b) Prove that any

More information

Divisibility. Chapter Divisors and Residues

Divisibility. Chapter Divisors and Residues Chapter 1 Divisibility Number theory is concerned with the properties of the integers. By the word integers we mean the counting numbers 1, 2, 3,..., together with their negatives and zero. Accordingly

More information

11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic

11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic 11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic Bezout s Lemma Let's look at the values of 4x + 6y when x and y are integers. If x is -6 and y is 4 we

More information

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska LECTURE 12 CHAPTER 4 NUMBER THEORY PART1: Divisibility PART 2: Primes PART 1: DIVISIBILITY Basic Definitions Definition Given m,n Z, we say

More information

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9.1 Chapter 9 Objectives

More information

A VLSI Algorithm for Modular Multiplication/Division

A VLSI Algorithm for Modular Multiplication/Division A VLSI Algorithm for Modular Multiplication/Division Marcelo E. Kaihara and Naofumi Takagi Department of Information Engineering Nagoya University Nagoya, 464-8603, Japan mkaihara@takagi.nuie.nagoya-u.ac.jp

More information

Fast Fraction-Integer Method for Computing Multiplicative Inverse

Fast Fraction-Integer Method for Computing Multiplicative Inverse Fast Fraction-Integer Method for Computing Multiplicative Inverse Hani M AL-Matari 1 and Sattar J Aboud 2 and Nidal F Shilbayeh 1 1 Middle East University for Graduate Studies, Faculty of IT, Jordan-Amman

More information

5: The Integers (An introduction to Number Theory)

5: The Integers (An introduction to Number Theory) c Oksana Shatalov, Spring 2017 1 5: The Integers (An introduction to Number Theory) The Well Ordering Principle: Every nonempty subset on Z + has a smallest element; that is, if S is a nonempty subset

More information

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane.

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane. Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane c Sateesh R. Mane 2018 3 Lecture 3 3.1 General remarks March 4, 2018 This

More information

REVIEW Chapter 1 The Real Number System

REVIEW Chapter 1 The Real Number System REVIEW Chapter The Real Number System In class work: Complete all statements. Solve all exercises. (Section.4) A set is a collection of objects (elements). The Set of Natural Numbers N N = {,,, 4, 5, }

More information

Sorting n Objects with a k-sorter. Richard Beigel. Dept. of Computer Science. P.O. Box 2158, Yale Station. Yale University. New Haven, CT

Sorting n Objects with a k-sorter. Richard Beigel. Dept. of Computer Science. P.O. Box 2158, Yale Station. Yale University. New Haven, CT Sorting n Objects with a -Sorter Richard Beigel Dept. of Computer Science P.O. Box 258, Yale Station Yale University New Haven, CT 06520-258 John Gill Department of Electrical Engineering Stanford University

More information

CHAPTER 2 NUMBER SYSTEMS

CHAPTER 2 NUMBER SYSTEMS CHAPTER 2 NUMBER SYSTEMS The Decimal Number System : We begin our study of the number systems with the familiar decimal number system. The decimal system contains ten unique symbol 0, 1, 2, 3, 4, 5, 6,

More information

Lecture 11. Advanced Dividers

Lecture 11. Advanced Dividers Lecture 11 Advanced Dividers Required Reading Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design Chapter 15 Variation in Dividers 15.3, Combinational and Array Dividers Chapter 16, Division

More information

1 Overview and revision

1 Overview and revision MTH6128 Number Theory Notes 1 Spring 2018 1 Overview and revision In this section we will meet some of the concerns of Number Theory, and have a brief revision of some of the relevant material from Introduction

More information

Divisibility. Def: a divides b (denoted a b) if there exists an integer x such that b = ax. If a divides b we say that a is a divisor of b.

Divisibility. Def: a divides b (denoted a b) if there exists an integer x such that b = ax. If a divides b we say that a is a divisor of b. Divisibility Def: a divides b (denoted a b) if there exists an integer x such that b ax. If a divides b we say that a is a divisor of b. Thm: (Properties of Divisibility) 1 a b a bc 2 a b and b c a c 3

More information

and LCM (a, b, c) LCM ( a, b) LCM ( b, c) LCM ( a, c)

and LCM (a, b, c) LCM ( a, b) LCM ( b, c) LCM ( a, c) CHAPTER 1 Points to Remember : REAL NUMBERS 1. Euclid s division lemma : Given positive integers a and b, there exists whole numbers q and r satisfying a = bq + r, 0 r < b.. Euclid s division algorithm

More information

Math 547, Exam 1 Information.

Math 547, Exam 1 Information. Math 547, Exam 1 Information. 2/10/10, LC 303B, 10:10-11:00. Exam 1 will be based on: Sections 5.1, 5.2, 5.3, 9.1; The corresponding assigned homework problems (see http://www.math.sc.edu/ boylan/sccourses/547sp10/547.html)

More information

MATH Fundamental Concepts of Algebra

MATH Fundamental Concepts of Algebra MATH 4001 Fundamental Concepts of Algebra Instructor: Darci L. Kracht Kent State University April, 015 0 Introduction We will begin our study of mathematics this semester with the familiar notion of even

More information

LARGE PRIME NUMBERS (32, 42; 4) (32, 24; 2) (32, 20; 1) ( 105, 20; 0).

LARGE PRIME NUMBERS (32, 42; 4) (32, 24; 2) (32, 20; 1) ( 105, 20; 0). LARGE PRIME NUMBERS 1. Fast Modular Exponentiation Given positive integers a, e, and n, the following algorithm quickly computes the reduced power a e % n. (Here x % n denotes the element of {0,, n 1}

More information

REAL NUMBERS. Any positive integer a can be divided by another positive integer b in such a way that it leaves a remainder r that is smaller than b.

REAL NUMBERS. Any positive integer a can be divided by another positive integer b in such a way that it leaves a remainder r that is smaller than b. REAL NUMBERS Introduction Euclid s Division Algorithm Any positive integer a can be divided by another positive integer b in such a way that it leaves a remainder r that is smaller than b. Fundamental

More information

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri MATH 1101 haalshehri@ksu.edu.sa 1 Introduction To Number Systems First Section: Binary System Second Section: Octal Number System Third Section: Hexadecimal System 2 Binary System 3 Binary System The binary

More information