Posts tagged gcd

Snippet: Greatest Common Divisor, Stein’s Algorithm

Description: Computes the greatest common divisor of two non-negative integers using Stein’s algorithm. More information: Computing the Greatest Common Divisor Source: gcd_stein.hpp

Snippet: Greatest Common Divisor, Euclid’s Algorithm

Description: Computes the greatest common divisor of two non-negative integers using Euclid’s algorithm. More information: Computing the Greatest Common Divisor Source: gcd_euclid.hpp

Computing the Greatest Common Divisor

The greatest common divisor of two integers is the largest positive integer that divides them both. This article considers two algorithms for computing gcd(u,v), the greatest common divisor of u and v [...]