6 lines
142 B
Forth
6 lines
142 B
Forth
: gcd ( a b -- n )
|
|
begin dup while tuck mod repeat drop ;
|
|
|
|
: lcm ( a b -- n )
|
|
over 0= over 0= or if 2drop 0 exit then
|
|
2dup gcd abs */ ;
|