Euclid's algorithm
Euclid's algorithm computes the greatest common divisor of two integers by repeatedly replacing them with a divisor and the remainder.
Elliptic Curve Cryptography for Developers
The Euclidean algorithm computes the greatest common divisor of two elements by repeatedly replacing a pair with the divisor and remainder.
- How it is used
- Supports polynomial division, gcd computation, irreducible-polynomial discovery, and inversion for elliptic-curve extension fields.
- How deep it goes
- Descends from quotient-and-remainder notation to coefficient-level C loops, edge checks, gcd iteration, and extended inversion.
- Examples
- Demonstrates simple polynomial divisions, degree-based equations, a C division routine, and an inversion main loop.
- What you can do after
- Build it from scratch as a polynomial quotient-remainder routine and use it to implement gcd and modular inversion.
Read how Elliptic Curve Cryptography for Developers explains Euclid's algorithm →
Modern C, Third Edition
Euclid's algorithm is an algorithm for computing the greatest common divisor by repeatedly replacing a pair of integers with a smaller equivalent pair.
- How it is used
- Uses recursion to turn mathematical gcd identities into a compact C algorithm.
- How deep it goes
- Defines gcd, derives subtraction and modulus recurrences, and traces a recursive implementation while stopping short of a full interface.
- Examples
- Uses gcd2 in C, equations for subtraction and remainder, and the recursive call sequence for gcd2(18,30).
- What you can do after
- Build it from scratch as a recursive C function for positive, ordered integer inputs.
Read how Modern C, Third Edition explains Euclid's algorithm →
Modern C
Euclid's algorithm is an algorithm for computing the greatest common divisor of two integers by repeatedly applying remainder operations.
- How it is used
- Uses Euclid's algorithm as a compact example for recursion, function calls, and translating mathematical statements into C algorithms.
- How deep it goes
- Explains the gcd definition, recurrence, preconditions, base case, and recursive C implementation, while deferring detailed assert treatment.
- Examples
- Uses gcd2(18, 30), a recursive call diagram, and short C listings as concrete demonstrations.
- What you can do after
- Build it from scratch as a recursive C function with explicit argument checks, a zero base case, and remainder-based recursion.
Also covered in
What to know first
- fixed-size arrayA fixed-size array is an indexed collection whose storage capacity or length is established when it is created and remains unchanged.
Related concepts
- greatest common divisorproduces · A greatest common divisor is a common divisor maximal under divisibility, conventionally selected as positive for integers or monic for polynomials.
- algorithmkind of · An algorithm is a finite, precisely specified procedure for performing a computation, transforming inputs into outputs, or solving a problem.
- mpz_invertused by · mpz_invert is a GMP function that computes a modular multiplicative inverse when one exists.
- polynomial divisionimplements · Polynomial division expresses a dividend as a divisor multiplied by a quotient plus a remainder of lower degree than the divisor.
- Aggregateuses · Aggregate is a collection operation that repeatedly applies an accumulator function to a sequence’s elements to produce a result.
- polynomial functionconfigured by · A polynomial function is a function expressible as a finite sum of monomials with constant coefficients and nonnegative integer exponents.
Questions about Euclid's algorithm
What is Euclid's algorithm?
Euclid's algorithm computes the greatest common divisor of two integers by repeatedly replacing them with a divisor and the remainder.
Which Manning books explain Euclid's algorithm?
Elliptic Curve Cryptography for Developers, Modern C, Third Edition and Modern C.
What should I know before learning Euclid's algorithm?
Manning books that teach Euclid's algorithm usually introduce fixed-size array first.
What is Euclid's algorithm a kind of?
Euclid's algorithm is a kind of algorithm. An algorithm is a finite, precisely specified procedure for performing a computation, transforming inputs into outputs, or solving a problem.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


