diff --git a/algorithms/gcd.py b/algorithms/gcd.py new file mode 100644 index 0000000..b9cae45 --- /dev/null +++ b/algorithms/gcd.py @@ -0,0 +1,4 @@ +def gcd(a,b): + if b == 0: + return a + return gcd(b,a%b) \ No newline at end of file diff --git a/algorithms/lcm.py b/algorithms/lcm.py new file mode 100644 index 0000000..488fce7 --- /dev/null +++ b/algorithms/lcm.py @@ -0,0 +1,2 @@ +def lcm(a,b): + return a/gcd(a,b)*b \ No newline at end of file