I dont even think its possible, but I know how to find a multiple, but not the least common one. You just multiply the 2 numbers together.
Offline
I looked this formula up Wikipedia and tested it, it should work: (this is GCF)
repeat until <((a) mod (b)) = (0)> set [temp v] to (b) set [b v] to ((a) mod (b)) set [a v] to (temp) end set [result v] to (b)Hope it's helpful, I'll look up least common multiple in a second.
Offline
LCM
set [a v] to (number 1) set [b v] to (number 2) set [guess v] to (a) // if a is the bigger number, it is more efficient repeat until <((a) mod (b)) = [0]> change [guess v] by (a) endGCF
set [a v] to (number 1) set [b v] to (number 2) set [guess v] to (a) repeat until <<((b) mod (guess)) = [0]> and <((a) mod (guess)) = [0]>> change [guess v] by (-1) endEdit: I'm sure there is a more efficient method for GCF, I'm just too tired to think right now (it would help if you had a list of primes though)
Last edited by MoreGamesNow (2012-04-02 23:16:58)
Offline
aryabtsev was spot on! here's the two algorithms combined...
http://scratch.mit.edu/projects/Ratty1967UK/2443899
Offline