3 ms·
a moldy oldy (in the tradition of Dijkstra and Euclid): proc gcd(n,m): do n>m ⇒ n:=n-m ⫿ m>n ⇒ m:=m-n od; return max(n,m) EDIT: note the different levels of
by 082349872349872 2y ago
a moldy oldy (in the tradition of Dijkstra and Euclid):
proc gcd(n,m): do n>m ⇒ n:=n-m ⫿ m>n ⇒ m:=m-n od; return max(n,m)
EDIT: note the different levels of abstraction: this is a program which implements a particular GCD algorithm, in a manner attempting to reflect the symmetry of the function which that algorithm calculates.