Scala Implementation of Eulcidean Algorithm