gcd static method

int gcd(
  1. int a,
  2. int b
)

Calculates the greatest common divisor (GCD) of two integers a and b.

Implementation

static int gcd(int a, int b) => b == 0 ? a : gcd(b, a % b);