Skip to content

Instantly share code, notes, and snippets.

@shoken0x
Last active November 25, 2015 09:08
Show Gist options
  • Save shoken0x/ab058ac48ad8ace6957a to your computer and use it in GitHub Desktop.
Save shoken0x/ab058ac48ad8ace6957a to your computer and use it in GitHub Desktop.
PCC Book: Euclidean algorithm
def gcd(a, b)
return a if b.zero?
gcd(b, a % b)
end
puts gcd(1071, 1029) # => 21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment