Forums > Gen

calc GCD (greatest common divisor) and LCM (least common multiple) inside gen~


Dec 19 2016 | 6:18 am

Dear Friends

Can I calc – as mentioned in the topic’s title – GCD (greatest common divisor) and LCM (least common multiple) of two values inside gen~?

thanks in advance for any indications

Dec 19 2016 | 8:11 am

You’ll need to use a codebox, as these require an iterative procedure, i.e. a for loop, and then implement one of the typical algorithms. Once you have GCD, LCM is easy:

— Pasted Max Patch, click to expand. —
Dec 19 2016 | 8:15 am

That’s really elegant. Thank you so much, Graham.

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Gen