matician - v2.0.0
    Preparing search index...

    Function gcd

    • Calculates the greatest common divisor (GCD) of two integers using the Euclidean algorithm.

      Parameters

      • a: number

        First integer.

      • b: number

        Second integer.

      Returns number

      The greatest common divisor of a and b.

      Will throw an error if either number is not an integer.

      gcd(48, 18); // returns 6
      gcd(7, 1); // returns 1