In Python, the math module contains a number of mathematical operations that can be performed fairly quickly. Starting from version 3.5, you can use the built-in function to calculate the gcd of any two integers - math.gcd(a, b)
.
GCD is short for Greatest Common Divisor.