Skip to content

Instantly share code, notes, and snippets.

@Arnauld
Created August 27, 2019 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arnauld/d58944cf4f18918e591c9d0f7e99734e to your computer and use it in GitHub Desktop.
Save Arnauld/d58944cf4f18918e591c9d0f7e99734e to your computer and use it in GitHub Desktop.
private static int gcd(int a, int b) {
BigInteger b1 = BigInteger.valueOf(a);
BigInteger b2 = BigInteger.valueOf(b);
BigInteger gcd = b1.gcd(b2);
return gcd.intValue();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment