-module(ef1).
-export([gcd/2]).

%tail-recursive definition of gcd

gcd(A,A) -> A;
gcd(A,B) -> {X,Y} = if
                        A > B -> {A,B};
                        true  -> {B,A}
                    end,
            gcd(X-Y,Y).
