Greatest common divisor
easyMaths and loops10 XP
Return the largest whole number that divides both a and b (both positive). Euclid's trick: gcd(a, b) = gcd(b, a mod b).
Examples
- Input: a = 12, b = 18Output: 6
- Input: a = 7, b = 13Output: 1
Examples use JSON: true/false/null are True/False/None in Python.