/**
 * Some Math functions you may find useful.
 *
 * @author Samuel A. Rebelsky
 * @author CSC153 2004S
 * @version 0.1 of April 2004
 */
public class ReallyHelpfulMathFunctions
{
  // +---------------+-----------------------------------------------------
  // | Class Methods |
  // +---------------+

  /**
   * Compute the greatest common divisor (gcd) of a and b.  The gcd 
   * of two integers is the largest integer that divides both integers.
   */
  public static int gcd(int x, int y)
  {
    return (int) gcd((long) x, (long) y);
  } // gcd(int, int)

  /**
   * Compute the greatest common divisor (gcd) of a and b.  The gcd 
   * of two integers is the largest integer that divides both integers.
   */
  public static long gcd(long x, long y)
  {
    // Euclid's method.  Look it up.
    if (y == 0) return x;
    else return gcd(y, x % y);
  } // gcd(long, long)

} // class ReallyHelpfulMathFunctions

