This commit is contained in:
Ingy döt Net 2013-06-05 21:47:54 +00:00
parent 1f1ad49427
commit 6f050a029e
2496 changed files with 37609 additions and 3031 deletions

View file

@ -0,0 +1,15 @@
% Implemented by Arjun Sunel
-module(lcm).
-export([main/0]).
main() ->
lcm(-3,4).
gcd(A, 0) ->
A;
gcd(A, B) ->
gcd(B, A rem B).
lcm(A,B) ->
abs(A*B div gcd(A,B)).

View file

@ -0,0 +1,5 @@
#lang racket
(lcm 3 4 5 6) ;returns 60
(lcm 8 108) ;returns 216
(gcd 8 108) ;returns 4
(gcd 108 216 432) ;returns 108