Version 0.2.1 Copyright C 2003-2009 Richard P

Total Page:16

File Type:pdf, Size:1020Kb

Version 0.2.1 Copyright C 2003-2009 Richard P Modern Computer Arithmetic Richard P. Brent and Paul Zimmermann Version 0.2.1 Copyright c 2003-2009 Richard P. Brent and Paul Zimmermann This electronic version is distributed under the terms and conditions of the Creative Commons license “Attribution-Noncommercial-No Derivative Works 3.0”. You are free to copy, distribute and transmit this book under the following conditions: Attribution. You must attribute the work in the manner specified • by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial. You may not use this work for commercial purposes. • No Derivative Works. You may not alter, transform, or build upon • this work. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to the web page below. Any of the above conditions can be waived if you get permission from the copyright holder. Nothing in this license impairs or restricts the author’s moral rights. For more information about the license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ Preface This is a book about algorithms for performing arithmetic, and their imple- mentation on modern computers. We are concerned with software more than hardware — we do not cover computer architecture or the design of computer hardware since good books are already available on these topics. Instead we focus on algorithms for efficiently performing arithmetic operations such as addition, multiplication and division, and their connections to topics such as modular arithmetic, greatest common divisors, the Fast Fourier Transform (FFT), and the computation of special functions. The algorithms that we present are mainly intended for arbitrary-precision arithmetic. That is, they are not limited by the computer wordsize of 32 or 64 bits, only by the memory and time available for the computation. We consider both integer and real (floating-point) computations. The book is divided into four main chapters, plus an appendix. Chapter 1 covers integer arithmetic. This has, of course, been considered in many other books and papers. However, there has been much recent progress, inspired in part by the application to public key cryptography, so most of the published books are now partly out of date or incomplete. Our aim has been to present the latest developments in a concise manner. Chapter 2 is concerned with the FFT and modular arithmetic, and their applications to computer arithmetic. We consider different number represen- tations, fast algorithms for multiplication, division and exponentiation, and the use of the Chinese Remainder Theorem (CRT). Chapter 3 covers floating-point arithmetic. Our concern is with high- precision floating-point arithmetic, implemented in software if the precision provided by the hardware (typically IEEE standard 64-bit arithmetic) is in- adequate. The algorithms described in this chapter focus on correct rounding, extending the IEEE standard to arbitrary precision. Chapter 4 deals with the computation, to arbitrary precision, of functions 3 4 Modern Computer Arithmetic, version 0.2.1 of March 23, 2009 such as sqrt, exp, ln, sin, cos, and more generally functions defined by power series or continued fractions. We also consider the computation of certain constants, such as π and (Euler’s constant) γ. Of course, the computation of special functions is a huge topic so we have had to be selective. In particular, we have concentrated on methods that are efficient and suitable for arbitrary- precision computations. For details that are omitted we give pointers in the Notes and References sections of each chapter, and in the bibliography. Finally, the Appendix contains pointers to implementations, useful web sites, mailing lists, and so on. The book is intended for anyone interested in the design and implemen- tation of efficient algorithms for computer arithmetic, and more generally efficient numerical algorithms. We did our best to present algorithms that are ready to implement in your favorite language, while keeping a high-level description. Although the book is not specifically intended as a textbook, it could be used in a graduate course in mathematics or computer science, and for this reason, as well as to cover topics that could not be discussed at length in the text, we have included exercises at the end of each chapter. For solutions to the exercises, please contact the authors. We thank the French National Institute for Research in Computer Science and Control (INRIA), the Australian National University (ANU), and the Australian Research Council (ARC), for their support. The book could not have been written without the contributions of many friends and colleagues, too numerous to mention here, but acknowledged in the text and in the Notes and References sections at the end of each chapter. Finally, we thank Erin Brent, who first suggested writing the book, and our wives Judy-anne and Marie, for their patience and encouragement. This is a preliminary version — there are still a few sections to be com- pleted. We welcome comments and corrections. Please send them to either of the authors. Richard Brent and Paul Zimmermann [email protected] [email protected] Canberra and Nancy, June 2008 Contents Preface 3 Contents 5 Notation 11 1 Integer Arithmetic 15 1.1 RepresentationandNotations . 15 1.2 AdditionandSubtraction . 16 1.3 Multiplication........................... 17 1.3.1 NaiveMultiplication . 18 1.3.2 Karatsuba’sAlgorithm . 19 1.3.3 Toom-CookMultiplication . 20 1.3.4 FastFourierTransform(FFT) . 22 1.3.5 Unbalanced Multiplication . 22 1.3.6 Squaring.......................... 24 1.3.7 Multiplication by a Constant . 24 1.4 Division .............................. 25 1.4.1 NaiveDivision.. .. 26 1.4.2 Divisor Preconditioning . 28 1.4.3 Divide and Conquer Division . 29 1.4.4 Newton’sMethod. 32 1.4.5 ExactDivision ...................... 32 1.4.6 Only Quotient or Remainder Wanted . 33 1.4.7 DivisionbyaConstant . 34 1.4.8 Hensel’sDivision . 35 1.5 Roots ............................... 36 1.5.1 SquareRoot........................ 36 5 6 Modern Computer Arithmetic, version 0.2.1 of March 23, 2009 1.5.2 k-thRoot ......................... 38 1.5.3 ExactRoot ........................ 39 1.6 GreatestCommonDivisor . 40 1.6.1 NaiveGCD ........................ 41 1.6.2 ExtendedGCD ...................... 43 1.6.3 Half GCD, Divide and Conquer GCD . 44 1.7 BaseConversion.......................... 47 1.7.1 QuadraticAlgorithms . 47 1.7.2 SubquadraticAlgorithms. 47 1.8 Exercises.............................. 50 1.9 NotesandReferences . 53 2 The FFT and Modular Arithmetic 55 2.1 Representation .......................... 55 2.1.1 ClassicalRepresentation . 55 2.1.2 Montgomery’sForm . 56 2.1.3 Residue Number Systems . 56 2.1.4 MSBvsLSBAlgorithms . 57 2.1.5 LinkwithPolynomials . 57 2.2 AdditionandSubtraction . 58 2.3 Multiplication........................... 58 2.3.1 Barrett’sAlgorithm. 59 2.3.2 Montgomery’s Multiplication . 60 2.3.3 McLaughlin’sAlgorithm . 64 2.3.4 SpecialModuli ...................... 65 2.3.5 Fast Multiplication Over GF(2)[x]............ 66 2.4 DivisionandInversion . 72 2.4.1 SeveralInversionsatOnce . 74 2.5 Exponentiation .......................... 76 2.5.1 BinaryExponentiation . 77 2.5.2 Base 2k Exponentiation . 78 2.5.3 Sliding Window and Redundant Representation . 79 2.6 Chinese Remainder Theorem . 80 2.7 Exercises.............................. 81 2.8 NotesandReferences . 82 Modern Computer Arithmetic, 0.0 7 § 3 Floating-Point Arithmetic 85 3.1 Representation .......................... 85 3.1.1 RadixChoice ....................... 86 3.1.2 ExponentRange ..................... 87 3.1.3 SpecialValues.. .. 88 3.1.4 SubnormalNumbers . 88 3.1.5 Encoding ......................... 89 3.1.6 Precision: Local, Global, Operation, Operand . 91 3.1.7 LinktoIntegers. .. 92 3.1.8 Ziv’s Algorithm and Error Analysis . 92 3.1.9 Rounding ......................... 94 3.1.10 Strategies ......................... 97 3.2 Addition, Subtraction, Comparison . 98 3.2.1 Floating-PointAddition . 99 3.2.2 Floating-PointSubtraction . 100 3.3 Multiplication . .. .. .102 3.3.1 Integer Multiplication via Complex FFT . 105 3.3.2 TheMiddleProduct . .107 3.4 ReciprocalandDivision . .109 3.4.1 Reciprocal.........................109 3.4.2 Division ..........................114 3.5 SquareRoot............................118 3.5.1 ReciprocalSquareRoot . .119 3.6 Conversion.............................122 3.6.1 Floating-PointOutput . .123 3.6.2 Floating-PointInput . .125 3.7 Exercises..............................126 3.8 NotesandReferences . .128 4 Newton’s Method and Function Evaluation 131 4.1 Introduction............................131 4.2 Newton’sMethod . .. .. .132 4.2.1 Newton’s MethodforInverse Roots . 134 4.2.2 Newton’s Method for Reciprocals . 134 4.2.3 Newton’s Method for (Reciprocal) Square Roots . 135 4.2.4 Newton’s Method for Formal Power Series . 136 4.2.5 Newton’s Method for Functional Inverses . 137 4.2.6 Higher Order Newton-like Methods . 138 8 Modern Computer Arithmetic, version 0.2.1 of March 23, 2009 4.3 ArgumentReduction . .139 4.3.1 Repeated Use of Doubling Formulæ . 141 4.3.2 LossofPrecision . .141 4.3.3 GuardDigits .......................142 4.3.4 Doubling versus Tripling . 143 4.4 PowerSeries............................143 4.4.1 Direct Power Series Evaluation . 148 4.4.2 Power Series With Argument Reduction . 148 4.4.3 Rectangular Series Splitting . 149 4.5 AsymptoticExpansions. .154 4.6 ContinuedFractions . .158 4.7 RecurrenceRelations . .161
Recommended publications
  • A Category-Theoretic Approach to Representation and Analysis of Inconsistency in Graph-Based Viewpoints
    A Category-Theoretic Approach to Representation and Analysis of Inconsistency in Graph-Based Viewpoints by Mehrdad Sabetzadeh A thesis submitted in conformity with the requirements for the degree of Master of Science Graduate Department of Computer Science University of Toronto Copyright c 2003 by Mehrdad Sabetzadeh Abstract A Category-Theoretic Approach to Representation and Analysis of Inconsistency in Graph-Based Viewpoints Mehrdad Sabetzadeh Master of Science Graduate Department of Computer Science University of Toronto 2003 Eliciting the requirements for a proposed system typically involves different stakeholders with different expertise, responsibilities, and perspectives. This may result in inconsis- tencies between the descriptions provided by stakeholders. Viewpoints-based approaches have been proposed as a way to manage incomplete and inconsistent models gathered from multiple sources. In this thesis, we propose a category-theoretic framework for the analysis of fuzzy viewpoints. Informally, a fuzzy viewpoint is a graph in which the elements of a lattice are used to specify the amount of knowledge available about the details of nodes and edges. By defining an appropriate notion of morphism between fuzzy viewpoints, we construct categories of fuzzy viewpoints and prove that these categories are (finitely) cocomplete. We then show how colimits can be employed to merge the viewpoints and detect the inconsistencies that arise independent of any particular choice of viewpoint semantics. Taking advantage of the same category-theoretic techniques used in defining fuzzy viewpoints, we will also introduce a more general graph-based formalism that may find applications in other contexts. ii To my mother and father with love and gratitude. Acknowledgements First of all, I wish to thank my supervisor Steve Easterbrook for his guidance, support, and patience.
    [Show full text]
  • United States Patent [19] [11] E Patent Number: Re
    United States Patent [19] [11] E Patent Number: Re. 33,629 Palmer et a1. [45] Reissued Date of Patent: Jul. 2, 1991 [54] NUMERIC DATA PROCESSOR 1973, IEEE Transactions on Computers vol. C-22, pp. [75] Inventors: John F. Palmer, Cambridge, Mass; 577-586. Bruce W. Ravenel, Nederland, Co1o.; Bulman, D. M. "Stack Computers: An Introduction," Ra? Nave, Haifa, Israel May 1977, Computer pp. 18-28. Siewiorek, Daniel H; Bell, C. Gordon; Newell, Allen, [73] Assignee: Intel Corporation, Santa Clara, Calif. “Computer Structures: Principles and Examples," 1977, [21] Appl. No.: 461,538 Chapter 29, pp. 470-485 McGraw-Hill Book Co. Palmer, John F., “The Intel Standard for Floatin [22] Filed: Jun. 1, 1990 g-Point Arithmetic,“ Nov. 8-11, 1977, IEEE COMP SAC 77 Proceedings, 107-112. Related US. Patent Documents Coonen, J. T., "Speci?cations for a Proposed Standard Reissue of: t for Floating-Point Arithmetic," Oct. 13, 1978, Mem. [64] Patent No.: 4,338,675 #USB/ERL M78172, pp. 1-32. Issued: Jul. 6, 1982 Pittman, T. and Stewart, R. G., “Microprocessor Stan Appl. No: 120.995 dards,” 1978, AFIPS Conference Proceedings, vol. 47, Filed: Feb. 13, 1980 pp. 935-938. “7094-11 System Support For Numerical Analysis,“ by [51] Int. Cl.-‘ ........................ .. G06F 7/48; G06F 9/00; William Kahan, Dept. of Computer Science, Univ. of G06F 11/00 Toronto, Aug. 1966, pp. 1-51. [52] US. Cl. .................................. .. 364/748; 364/737; “A Uni?ed Decimal Floating-Point Architecture For 364/745; 364/258 The Support of High-Level Languages,‘ by Frederic [58] Field of Search ............. .. 364/748, 745, 737, 736, N.
    [Show full text]
  • Faster Math Functions, Soundly
    Faster Math Functions, Soundly IAN BRIGGS, University of Utah, USA PAVEL PANCHEKHA, University of Utah, USA Standard library implementations of functions like sin and exp optimize for accuracy, not speed, because they are intended for general-purpose use. But applications tolerate inaccuracy from cancellation, rounding error, and singularities—sometimes even very high error—and many application could tolerate error in function implementations as well. This raises an intriguing possibility: speeding up numerical code by tuning standard function implementations. This paper thus introduces OpTuner, an automatic method for selecting the best implementation of mathematical functions at each use site. OpTuner assembles dozens of implementations for the standard mathematical functions from across the speed-accuracy spectrum. OpTuner then uses error Taylor series and integer linear programming to compute optimal assignments of function implementation to use site and presents the user with a speed-accuracy Pareto curve they can use to speed up their code. In a case study on the POV-Ray ray tracer, OpTuner speeds up a critical computation, leading to a whole program speedup of 9% with no change in the program output (whereas human efforts result in slower code and lower-quality output). On a broader study of 37 standard benchmarks, OpTuner matches 216 implementations to 89 use sites and demonstrates speed-ups of 107% for negligible decreases in accuracy and of up to 438% for error-tolerant applications. Additional Key Words and Phrases: Floating point, rounding error, performance, approximation theory, synthesis, optimization 1 INTRODUCTION Floating-point arithmetic is foundational for scientific, engineering, and mathematical software. This is because, while floating-point arithmetic is approximate, most applications tolerate minute errors [Piparo et al.
    [Show full text]
  • Modular Arithmetic
    CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 5 Modular Arithmetic One way to think of modular arithmetic is that it limits numbers to a predefined range f0;1;:::;N ¡ 1g, and wraps around whenever you try to leave this range — like the hand of a clock (where N = 12) or the days of the week (where N = 7). Example: Calculating the day of the week. Suppose that you have mapped the sequence of days of the week (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) to the sequence of numbers (0;1;2;3;4;5;6) so that Sunday is 0, Monday is 1, etc. Suppose that today is Thursday (=4), and you want to calculate what day of the week will be 10 days from now. Intuitively, the answer is the remainder of 4 + 10 = 14 when divided by 7, that is, 0 —Sunday. In fact, it makes little sense to add a number like 10 in this context, you should probably find its remainder modulo 7, namely 3, and then add this to 4, to find 7, which is 0. What if we want to continue this in 10 day jumps? After 5 such jumps, we would have day 4 + 3 ¢ 5 = 19; which gives 5 modulo 7 (Friday). This example shows that in certain circumstances it makes sense to do arithmetic within the confines of a particular number (7 in this example), that is, to do arithmetic by always finding the remainder of each number modulo 7, say, and repeating this for the results, and so on.
    [Show full text]
  • Modulo of a Negative Number1 1 Modular Arithmetic
    Algologic Technical Report # 01/2017 Modulo of a negative number1 S. Parthasarathy [email protected] Ref.: negamodulo.tex Ver. code: 20170109e Abstract This short article discusses an enigmatic question in elementary num- ber theory { that of finding the modulo of a negative number. Is this feasible to compute ? If so, how do we compute this value ? 1 Modular arithmetic In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" upon reaching a certain value - the modulus (plural moduli). The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book Disquisitiones Arithmeticae, published in 1801. Modular arithmetic is a fascinating aspect of mathematics. The \modulo" operation is often called as the fifth arithmetic operation, and comes after + − ∗ and = . It has use in many practical situations, particu- larly in number theory and cryptology [1] [2]. If x and n are integers, n < x and n =6 0 , the operation \ x mod n " is the remainder we get when n divides x. In other words, (x mod n) = r if there exists some integer q such that x = q ∗ n + r 1This is a LATEX document. You can get the LATEX source of this document from [email protected]. Please mention the Reference Code, and Version code, given at the top of this document 1 When r = 0 , n is a factor of x. When n is a factor of x, we say n divides x evenly, and denote it by n j x . The modulo operation can be combined with other arithmetic operators.
    [Show full text]
  • The Development and Understanding of the Concept of Quotient Group
    HISTORIA MATHEMATICA 20 (1993), 68-88 The Development and Understanding of the Concept of Quotient Group JULIA NICHOLSON Merton College, Oxford University, Oxford OXI 4JD, United Kingdom This paper describes the way in which the concept of quotient group was discovered and developed during the 19th century, and examines possible reasons for this development. The contributions of seven mathematicians in particular are discussed: Galois, Betti, Jordan, Dedekind, Dyck, Frobenius, and H61der. The important link between the development of this concept and the abstraction of group theory is considered. © 1993 AcademicPress. Inc. Cet article decrit la d6couverte et le d6veloppement du concept du groupe quotient au cours du 19i~me si~cle, et examine les raisons possibles de ce d6veloppement. Les contributions de sept math6maticiens seront discut6es en particulier: Galois, Betti, Jordan, Dedekind, Dyck, Frobenius, et H61der. Le lien important entre le d6veloppement de ce concept et l'abstraction de la th6orie des groupes sera consider6e. © 1993 AcademicPress, Inc. Diese Arbeit stellt die Entdeckung beziehungsweise die Entwicklung des Begriffs der Faktorgruppe wfihrend des 19ten Jahrhunderts dar und untersucht die m/)glichen Griinde for diese Entwicklung. Die Beitrfi.ge von sieben Mathematikern werden vor allem diskutiert: Galois, Betti, Jordan, Dedekind, Dyck, Frobenius und H61der. Die wichtige Verbindung zwischen der Entwicklung dieses Begriffs und der Abstraktion der Gruppentheorie wird betrachtet. © 1993 AcademicPress. Inc. AMS subject classifications: 01A55, 20-03 KEY WORDS: quotient group, group theory, Galois theory I. INTRODUCTION Nowadays one can hardly conceive any more of a group theory without factor groups... B. L. van der Waerden, from his obituary of Otto H61der [1939] Although the concept of quotient group is now considered to be fundamental to the study of groups, it is a concept which was unknown to early group theorists.
    [Show full text]
  • Grade 7/8 Math Circles Modular Arithmetic the Modulus Operator
    Faculty of Mathematics Centre for Education in Waterloo, Ontario N2L 3G1 Mathematics and Computing Grade 7/8 Math Circles April 3, 2014 Modular Arithmetic The Modulus Operator The modulo operator has symbol \mod", is written as A mod N, and is read \A modulo N" or "A mod N". • A is our - what is being divided (just like in division) • N is our (the plural is ) When we divide two numbers A and N, we get a quotient and a remainder. • When we ask for A ÷ N, we look for the quotient of the division. • When we ask for A mod N, we are looking for the remainder of the division. • The remainder A mod N is always an integer between 0 and N − 1 (inclusive) Examples 1. 0 mod 4 = 0 since 0 ÷ 4 = 0 remainder 0 2. 1 mod 4 = 1 since 1 ÷ 4 = 0 remainder 1 3. 2 mod 4 = 2 since 2 ÷ 4 = 0 remainder 2 4. 3 mod 4 = 3 since 3 ÷ 4 = 0 remainder 3 5. 4 mod 4 = since 4 ÷ 4 = 1 remainder 6. 5 mod 4 = since 5 ÷ 4 = 1 remainder 7. 6 mod 4 = since 6 ÷ 4 = 1 remainder 8. 15 mod 4 = since 15 ÷ 4 = 3 remainder 9.* −15 mod 4 = since −15 ÷ 4 = −4 remainder Using a Calculator For really large numbers and/or moduli, sometimes we can use calculators to quickly find A mod N. This method only works if A ≥ 0. Example: Find 373 mod 6 1. Divide 373 by 6 ! 2. Round the number you got above down to the nearest integer ! 3.
    [Show full text]
  • RING THEORY 1. Ring Theory a Ring Is a Set a with Two Binary Operations
    CHAPTER IV RING THEORY 1. Ring Theory A ring is a set A with two binary operations satisfying the rules given below. Usually one binary operation is denoted `+' and called \addition," and the other is denoted by juxtaposition and is called \multiplication." The rules required of these operations are: 1) A is an abelian group under the operation + (identity denoted 0 and inverse of x denoted x); 2) A is a monoid under the operation of multiplication (i.e., multiplication is associative and there− is a two-sided identity usually denoted 1); 3) the distributive laws (x + y)z = xy + xz x(y + z)=xy + xz hold for all x, y,andz A. Sometimes one does∈ not require that a ring have a multiplicative identity. The word ring may also be used for a system satisfying just conditions (1) and (3) (i.e., where the associative law for multiplication may fail and for which there is no multiplicative identity.) Lie rings are examples of non-associative rings without identities. Almost all interesting associative rings do have identities. If 1 = 0, then the ring consists of one element 0; otherwise 1 = 0. In many theorems, it is necessary to specify that rings under consideration are not trivial, i.e. that 1 6= 0, but often that hypothesis will not be stated explicitly. 6 If the multiplicative operation is commutative, we call the ring commutative. Commutative Algebra is the study of commutative rings and related structures. It is closely related to algebraic number theory and algebraic geometry. If A is a ring, an element x A is called a unit if it has a two-sided inverse y, i.e.
    [Show full text]
  • Math 371 Lecture #21 §6.1: Ideals and Congruence, Part II §6.2: Quotients and Homomorphisms, Part I
    Math 371 Lecture #21 x6.1: Ideals and Congruence, Part II x6.2: Quotients and Homomorphisms, Part I Why ideals? For a commutative ring R with identity, we have for a; b 2 R, that a j b if and only if (b) ⊆ (a), and u 2 R is a unit if and only if (u) = R. Having the established the notion of an ideal, we can now extend the notion of congruence to any ring with respect to any ideal. Definition. Let I be an ideal in a ring R. For a; b 2 R, we say a is congruent to b modulo I, written a ≡ b (mod I), provided that a − b 2 I. Examples. (a) For any integer k ≥ 1, we see that congruence modulo k in Z is the same thing as congruence modulo the principal ideal (k) = kZ of Z. (b) For a field F and any nonconstant polynomial p(x) in F [x], we see that congruence modulo p(x) in F [x] is the same thing as congruence modulo the principal ideal (p(x)) of F [x]. We know that the congruence in each of these examples is an equivalence relation, but is this the case for an arbitrary ideal of an arbitrary ring? Theorem 6.4. For any ideal I of a ring R, the relation of congruence modulo I is an equivalence relation. Proof. Reflexive: Since I is closed under subtraction, we have for any a 2 R that a − a = 0R 2 I; hence a ≡ a (mod I). Symmetric: For a; b 2 R, suppose that a ≡ b (mod I).
    [Show full text]
  • Lecture 7: Unit Group Structure
    MATH 361: NUMBER THEORY | SEVENTH LECTURE 1. The Unit Group of Z=nZ Consider a nonunit positive integer, Y n = pep > 1: The Sun Ze Theorem gives a ring isomorphism, Y e Z=nZ =∼ Z=p p Z: The right side is the cartesian product of the rings Z=pep Z, meaning that addition and multiplication are carried out componentwise. It follows that the corresponding unit group is × Y e × (Z=nZ) =∼ (Z=p p Z) : Thus to study the unit group (Z=nZ)× it suffices to consider (Z=peZ)× where p is prime and e > 0. Recall that in general, × j(Z=nZ) j = φ(n); so that for prime powers, e × e e−1 j(Z=p Z) j = φ(p ) = p (p − 1); and especially for primes, × j(Z=pZ) j = p − 1: Here are some examples of unit groups modulo prime powers, most but not quite all cyclic. × 0 (Z=2Z) = (f1g; ·) = (f2 g; ·) =∼ (f0g; +) = Z=Z; × 0 1 (Z=3Z) = (f1; 2g; ·) = (f2 ; 2 g; ·) =∼ (f0; 1g; +) = Z=2Z; × 0 1 (Z=4Z) = (f1; 3g; ·) = (f3 ; 3 g; ·) =∼ (f0; 1g; +) = Z=2Z; × 0 1 2 3 (Z=5Z) = (f1; 2; 3; 4g; ·) = (f2 ; 2 ; 2 ; 2 g; ·) =∼ (f0; 1; 2; 3g; +) = Z=4Z; × 0 1 2 3 4 5 (Z=7Z) = (f1; 2; 3; 4; 5; 6g; ·) = (f3 ; 3 ; 3 ; 3 ; 3 ; 3 g; ·) =∼ (f0; 1; 2; 3; 4; 5g; +) = Z=6Z; × 0 0 1 0 0 1 1 1 (Z=8Z) = (f1; 3; 5; 7g; ·) = (f3 5 ; 3 5 ; 3 5 ; 3 5 g; ·) =∼ (f0; 1g × f0; 1g; +) = Z=2Z × Z=2Z; × 0 1 2 3 4 5 (Z=9Z) = (f1; 2; 4; 5; 7; 8g; ·) = (f2 ; 2 ; 2 ; 2 ; 2 ; 2 g; ·) =∼ (f0; 1; 2; 3; 4; 5g; +) = Z=6Z: 1 2 MATH 361: NUMBER THEORY | SEVENTH LECTURE 2.
    [Show full text]
  • Computing Mod Without Mod
    Computing Mod Without Mod Mark A. Will and Ryan K. L. Ko Cyber Security Lab The University of Waikato, New Zealand fwillm,[email protected] Abstract. Encryption algorithms are designed to be difficult to break without knowledge of the secrets or keys. To achieve this, the algorithms require the keys to be large, with some algorithms having a recommend size of 2048-bits or more. However most modern processors only support computation on 64-bits at a time. Therefore standard operations with large numbers are more complicated to implement. One operation that is particularly challenging to implement efficiently is modular reduction. In this paper we propose a highly-efficient algorithm for solving large modulo operations; it has several advantages over current approaches as it supports the use of a variable sized lookup table, has good spatial and temporal locality allowing data to be streamed, and only requires basic processor instructions. Our proposed algorithm is theoretically compared to widely used modular algorithms, before practically compared against the state-of-the-art GNU Multiple Precision (GMP) large number li- brary. 1 Introduction Modular reduction, also known as the modulo or mod operation, is a value within Y, such that it is the remainder after Euclidean division of X by Y. This operation is heavily used in encryption algorithms [6][8][14], since it can \hide" values within large prime numbers, often called keys. Encryption algorithms also make use of the modulo operation because it involves more computation when compared to other operations like add. Meaning that computing the modulo operation is not as simple as just adding bits.
    [Show full text]
  • Unitary and Symmetric Structure in Deep Neural Networks
    University of Kentucky UKnowledge Theses and Dissertations--Mathematics Mathematics 2020 Unitary and Symmetric Structure in Deep Neural Networks Kehelwala Dewage Gayan Maduranga University of Kentucky, [email protected] Author ORCID Identifier: https://orcid.org/0000-0002-6626-9024 Digital Object Identifier: https://doi.org/10.13023/etd.2020.380 Right click to open a feedback form in a new tab to let us know how this document benefits ou.y Recommended Citation Maduranga, Kehelwala Dewage Gayan, "Unitary and Symmetric Structure in Deep Neural Networks" (2020). Theses and Dissertations--Mathematics. 77. https://uknowledge.uky.edu/math_etds/77 This Doctoral Dissertation is brought to you for free and open access by the Mathematics at UKnowledge. It has been accepted for inclusion in Theses and Dissertations--Mathematics by an authorized administrator of UKnowledge. For more information, please contact [email protected]. STUDENT AGREEMENT: I represent that my thesis or dissertation and abstract are my original work. Proper attribution has been given to all outside sources. I understand that I am solely responsible for obtaining any needed copyright permissions. I have obtained needed written permission statement(s) from the owner(s) of each third-party copyrighted matter to be included in my work, allowing electronic distribution (if such use is not permitted by the fair use doctrine) which will be submitted to UKnowledge as Additional File. I hereby grant to The University of Kentucky and its agents the irrevocable, non-exclusive, and royalty-free license to archive and make accessible my work in whole or in part in all forms of media, now or hereafter known.
    [Show full text]