Book contents
- Frontmatter
- Contents
- Introduction
- 1 Cyclohexane, cryptography, codes, and computer algebra
- I Euclid
- 2 Fundamental algorithms
- 3 The Euclidean Algorithm
- 4 Applications of the Euclidean Algorithm
- 5 Modular algorithms and interpolation
- 6 The resultant and gcd computation
- 7 Application: Decoding BCH codes
- II Newton
- III Gauß
- IV Fermat
- V Hilbert
- Appendix
- Sources of illustrations
- Sources of quotations
- List of algorithms
- List of figures and tables
- References
- List of notation
- Index
- The Holy Qur'ān (732)
4 - Applications of the Euclidean Algorithm
from I - Euclid
Published online by Cambridge University Press: 05 May 2013
- Frontmatter
- Contents
- Introduction
- 1 Cyclohexane, cryptography, codes, and computer algebra
- I Euclid
- 2 Fundamental algorithms
- 3 The Euclidean Algorithm
- 4 Applications of the Euclidean Algorithm
- 5 Modular algorithms and interpolation
- 6 The resultant and gcd computation
- 7 Application: Decoding BCH codes
- II Newton
- III Gauß
- IV Fermat
- V Hilbert
- Appendix
- Sources of illustrations
- Sources of quotations
- List of algorithms
- List of figures and tables
- References
- List of notation
- Index
- The Holy Qur'ān (732)
Summary
This chapter presents several applications of the Extended Euclidean Algorithm: modular arithmetic, in particular modular inverses; linear Diophantine equations; and continued fractions. The latter in turn are useful for problems outside of computer algebra: devising astronomical calendars and musical scale systems.
Modular arithmetic
We start with some applications. The first one is checking programs for correctness. In Part II of this book, we will see extremely fast algorithms for multiplication of large integers. These methods are also considerably more complicated than classical multiplication, and an implementation quite error-prone. So we may want to test correctness on many inputs. We take inputs a and b, say positive integers of 10000 words each, and the output c of 20000 words. Can we check that a·b = c without using our own software?
The solution is a modular test. We take a single-precision prime p and check whether a·b ≡ c mod p (read “a·b and c are congruent modulo p”), which means that a·b−c is divisible by p, or equivalently, a·b and c have the same remainder on division by p. By (1) below, it is sufficient for this purpose to compute the remainders a* = a rem p, b* = b rem p, c* = c rem p and check whether a*·b* ≡ c* mod p, since a·b ≡ a*·b* mod p.
- Type
- Chapter
- Information
- Modern Computer Algebra , pp. 69 - 96Publisher: Cambridge University PressPrint publication year: 2013