Euclidean Algorithm to Calculate Greatest Common Divisor (GCD) of 2 numbers

Reading time: 20 minutes | Coding time: 5 minutes

The GCD of two integers X and Y is the largest integer that divides both of X and Y (without leaving a remainder). Greatest Common Divisor is, also, known as greatest common factor (gcf), highest common factor (hcf), greatest common measure (gcm) and highest common divisor.

This is a companion discussion topic for the original entry at