Posted: Wed Oct 20, 2010 7:11 pm Post subject: Turing Program
I was able to do Permutations n combination
Anyone able to do the GCD or LCM or the Number Theory? I have no clue :S
hgh.jpg
Description:
Filesize:
480.55 KB
Viewed:
106 Time(s)
Sponsor Sponsor
SNIPERDUDE
Posted: Wed Oct 20, 2010 10:42 pm Post subject: RE:Turing Program
Let's tackle this one at a time then. Starting with LCM, what have you tried? What aspect are you stuck with? We can't do your homework for you, but we can help you understand whatever it is you're stuck on.
Carey
Posted: Thu Oct 21, 2010 6:56 pm Post subject: RE:Turing Program
fcn gcd (a, b :int) : int
if b is 0 then return a
if anything else then return gcd (b, a mod b) %this is the recursive call. It will call the function from inside itself. At first it's hard to wrap your head around.
end
You can then use the GCD method in finding the LCM by following the formula here