Greatest common divisor
A greatest common divisor is a common divisor maximal under divisibility, conventionally selected as positive for integers or monic for polynomials.
Elliptic Curve Cryptography for Developers
The greatest common divisor of polynomials is a highest-degree polynomial that divides each given polynomial, defined up to multiplication by a nonzero constant.
- How it is used
- Supports irreducible-polynomial searches and polynomial-field operations needed for elliptic-curve slopes and pairings.
- How deep it goes
- Explains zero cases, degree ordering, remainder iteration, termination, and C-style implementation, stopping short of a numeric worked polynomial.
- Examples
- Uses a simple Euclidean remainder progression and C listings for initialization, the main loop, termination, and cleanup.
- What you can do after
- Build it from scratch using polynomial division remainders and handle zero inputs, degree ordering, constants, and resource cleanup.
Read how Elliptic Curve Cryptography for Developers explains greatest common divisor →
Modern C, Third Edition
The greatest common divisor of two positive integers is the greatest positive integer that divides both of them.
- How it is used
- Uses gcd as a concrete example for recursion, function calls, local variables, and translating mathematical statements into algorithms.
- How deep it goes
- Defines gcd, states two recursive identities, and implements Euclid’s algorithm, while noting that the initial interface assumes valid positive arguments.
- Examples
- Demonstrates recursive gcd2(18, 30) calls and a C implementation using assertions, remainder calculation, and a zero-remainder base case.
- What you can do after
- Build it from scratch in C by applying Euclid’s remainder rule recursively to positive integer arguments.
Read how Modern C, Third Edition explains greatest common divisor →
Also covered in
- Modern C
- 100 C++ Mistakes and How to Avoid Them
- Fabulous Adventures in Data Structures and Algorithms
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
- polynomial contentequivalent to · The content of a polynomial is the common factor of its coefficients, typically normalized according to the coefficient domain.
- Euclid's algorithmproduced by · Euclid's algorithm computes the greatest common divisor of two integers by repeatedly replacing them with a divisor and the remainder.
- common-factors attackused by · A cryptanalytic attack that factors RSA moduli by finding a prime factor shared by two public keys.
- pure functionkind of · A pure function is a function whose result depends only on its explicit inputs and whose evaluation has no externally observable side effects.
Questions about greatest common divisor
What is greatest common divisor?
A greatest common divisor is a common divisor maximal under divisibility, conventionally selected as positive for integers or monic for polynomials.
Which Manning books explain greatest common divisor?
Elliptic Curve Cryptography for Developers and Modern C, Third Edition.
What should I know before learning greatest common divisor?
Manning books that teach greatest common divisor usually introduce fixed-size array first.
What is greatest common divisor a kind of?
Greatest common divisor is a kind of pure function. A pure function is a function whose result depends only on its explicit inputs and whose evaluation has no externally observable side effects.
What is greatest common divisor also called?
Greatest common divisor is also called gcd.
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.

