[/SIZE]
Originally posted by nonevent99
Let's see how good your cerebral hash functions are...
What's the name of that famous math algorithm where you take two numbers x and y, mod one by the other to get z, and then discard max(x,y) so now you're left with x' = min(x,y) and z.
Should this be you take the big mod small ? Because if you do small mod big = small and then discard big you're left with (small, small)
Repeat process with x' and z until one of the numbers in your hand is 1. The other is X.
Should this be stop at 0?
Assuming you have to do big mod small
Consider (18, 4)
z = 18 mod 4 = 2
then we have (2, 4)
z = 4 mod 2 = 0
so now we have (0, 2)
if we keep doing there is going to be some error since 2 mod 0 is is undefined since 2/0 is undefined
What number X do you end up with? What is the running time?
[/SIZE]
Bookmarks