开发者

how is calculated gcd of 4 number? [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 10 years ago.

开发者_C百科 Improve this question

does gcd(gcd(a,b),gcd(c,d)) equal gcd(a,b,c,d)?or how can i calculate gcd of 4 number?


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))


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜