You are viewing a single comment's thread. Return to all comments →
Also in Scala, based on the recursive implementation (3rd ...) found here :
https://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations
def gcd(x: Int, y: Int): Int = if (y == 0) x else gcd(y, x % y)
Seems like cookies are disabled on this browser, please enable them to open this website
Computing the GCD
You are viewing a single comment's thread. Return to all comments →
Also in Scala, based on the recursive implementation (3rd ...) found here :
https://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations