Lowest common multiple and greatest common divisor
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
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).
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."
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?
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
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?
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?
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS