Programming-Idioms

History of Idiom 74 > diff from v18 to v19

Edit summary for version 19 :
New Java implementation by user [programming-idioms.org]

Version 18

2016-07-21, 07:19:12

Version 19

2016-12-04, 21:26:44

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.

Imports
import java.math.BigInteger;
Code
BigInteger x = a.gcd(b);
Doc URL
https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#gcd(java.math.BigInteger)
Demo URL
http://ideone.com/FrAe3S