fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 75: Compute LCM
Idiom # 75: Compute LCM
See
programming-idioms.org
:
Code
a * b / (a.gcd b)
What are effects?
Running example
ex75 is lcm (a0,b0 int) int => a0 * b0 / (a0.gcd b0) a := int 2147483647 # is the eighth Mersenne prime, equal to 231^-1 b := int 2305843009213693951 # another Mersenne prime x := lcm a b say x
What are effects?
last changed: 2024-07-01
next: Idiom # 76: Binary digits from an integer