Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

3 of 3
Commonmark migration

MATL, 7 bytes

pG1$Zm/

Try it Online!

Explanation

Since we can't explicitly use the builtin GCD function (Zd in MATL), I have exploited the fact that the least common multiple of a and b times the greatest common denominator of a and b is equal to the product of a and b.

p % Grab the input implicitly and multiply the two elements
G % Grab the input again, explicitly this time
1$Zm % Compute the least-common multiple
/ % Divide the two to get the greatest common denominator
Suever
  • 11.2k
  • 1
  • 24
  • 52

AltStyle によって変換されたページ (->オリジナル) /