diff options
author | Marvin Borner | 2024-03-21 12:51:02 +0100 |
---|---|---|
committer | Marvin Borner | 2024-03-21 12:51:02 +0100 |
commit | 93b53a5354620d94b128008d0b17670cc87c92f5 (patch) | |
tree | c1f5c80b9d2fb0c8750ddb69b281450e7033e556 /std/Math.bruijn | |
parent | 8b82e5d7f485fc76250b9ed2ad756b913e930df1 (diff) |
Added lcm
Diffstat (limited to 'std/Math.bruijn')
-rw-r--r-- | std/Math.bruijn | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/std/Math.bruijn b/std/Math.bruijn index 5952592..e2a9466 100644 --- a/std/Math.bruijn +++ b/std/Math.bruijn @@ -73,6 +73,12 @@ gcd z [[[=?0 1 (2 0 (1 % 0))]]] ⧗ Number → Number → Number :test ((gcd (+10) (+5)) =? (+5)) (true) :test ((gcd (+3) (+8)) =? (+1)) (true) +# least common multiple using gcd +lcm [[=?1 1 (=?0 0 |(1 / (gcd 1 0) ⋅ 0))]] ⧗ Number → Number → Number + +:test ((lcm (+12) (+18)) =? (+36)) (true) +:test ((lcm (+42) (+25)) =? (+1050)) (true) + # power function pow […!!… (iterate (…⋅… 0) (+1))] ⧗ Number → Number → Number |