History of Idiom 74 > diff from v16 to v17
Edit summary for version 17 by programming-idioms.org:
[Rust] -DocURL dead link
[Rust] -DocURL dead link
↷
Version 16
2016-02-18, 16:58:01
Version 17
2016-05-28, 23:54:48
Idiom #74 Compute GCD
Compute the greatest common divisor x of big integers a and b. Use an integer type able to handle huge numbers.
Idiom #74 Compute GCD
Compute the greatest common divisor x of big integers a and b. Use an integer type able to handle huge numbers.
Demo URL
https://play.rust-lang.org/?code=extern%20crate%20num%3B%0A%0Ause%20num%3A%3AInteger%3B%0Ause%20num%3A%3Abigint%3A%3ABigInt%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20a%20%3D%20BigInt%3A%3Aparse_bytes(b%226000000000000%22%2C%2010).unwrap()%3B%0A%20%20%20%20let%20b%20%3D%20BigInt%3A%3Aparse_bytes(b%229000000000000%22%2C%2010).unwrap()%3B%0A%20%20%20%20let%20x%20%3D%20a.gcd(%26b)%3B%0A%20%20%20%20println!(%22%7B%7D%22%2C%20x)%3B%0A%7D%0A&version=stable
Comments bubble
Comments bubble