Log in
← All problems

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

Examples use JSON: true/false/null are True/False/None in Python.

Run examples checks the examples above. Submit also runs 3 hidden tests.