Algorithums in Ruby
Greatest Common Divisor
Ruby has a native implementation of the greatest common divisor.
| 1 2 |  | 
However as a pure academic exercise lets implement Euclid’s algorithm for finding the greatest common divisor between any number of numbers in ruby!
| 1 2 3 4 5 6 7 |  | 
Greatest Common Divisor for three numbers
| 1 2 3 |  | 
Extending this to a generic algorithm that can take any number of numbers
| 1 2 3 4 5 6 7 8 |  |