RPTools.net
http://forums.rptools.net/

Lowest common multiple and greatest common divisor
http://forums.rptools.net/viewtopic.php?f=20&t=27251
Page 1 of 1

Author:  Irrlicht [ Sun Jul 16, 2017 1:39 pm ]
Post subject:  Lowest common multiple and greatest common divisor

I see there aren't built-in functions for this, so what would you advise to make macros where you can calculate lowest common multiple and greatest common divisor from lists of numbers (possibly with virtually unlimited lists... within reason, of course... I know throwing in a list of a thousand numbers could be taxing... and probably will never have lists longer than ten numbers).

Author:  aliasmask [ Sun Jul 16, 2017 6:49 pm ]
Post subject:  Re: Lowest common multiple and greatest common divisor

You mean like factors? So, for 10 it would be 2,5 and 20 would be 2,2,5?

Author:  wolph42 [ Mon Jul 17, 2017 2:35 am ]
Post subject:  Re: Lowest common multiple and greatest common divisor

multiples of 4: 4,8,12,16,20,24, etc
multiples of 6: 6,12,18,24,etc

Hence the 'common multiples' are: 12,24,36,etc

So the LCM (lowest common multiple) of 4 and 6 is 12

divisors of 4: 1,2,4 (aka factors as AM mentioned)
divisors of 6: 1,2,3,6

'common divisors': 1,2

So the GCD (greatest common divisor) of 4 and 6 is 2.

My Q is: what on earth do you require this for in MT?

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/