does gcd(gcd(a,b),gcd(c,d))
equal gcd(a,b,c,d)
?or how can i calculate gcd of 4 number?
views:
59answers:
2
+4
A:
yes that is correct. If you are finding the gcd of (a,b,c,d) then any split should work. So gcd(a,b,c,d) = gcd(gcd (a,b) , gcd(c,d))
Sagar V
2010-10-06 16:37:53
+1 for jinx! :)
JoshD
2010-10-06 16:40:47
+4
A:
Yes. GCD(a,b,c,d) = GCD(a, GCD(b, GCD(c, d))) (or any other order, its associative and commutative.) Oh, and just in case you didn't know, you can use the Euclidean algorithm to compute GCD very quickly.
JoshD
2010-10-06 16:38:10