Calcalates greatest common Divisor of m and n.
@access		public
@param		int		m		Natural Number m
@param		int		n		Natural Number n
@return		int
778253
public function gcd( $m, $n )
	{
		if( $n != 0 )
			return NaturalNumbers::gcd( $n, $m % $n );
		else
			return $m;
	}
8486
def phi( n ):
  """"""

  assert isinstance( n, integer_types )

  if n < 3: return 1

  result = 1
  ff = factorization( n )
  for f in ff:
    e = f[1]
    if e > 1:
      result = result * f[0] ** (e-1) * ( f[0] - 1 )
    else:
      result = result * ( f[0] - 1 )
  return result
275596
def order_mod( x, m ):
  

  # Warning: this implementation is not very clever, and will
  # take a long time if m is very large.

  if m <= 1: return 0

  assert gcd( x, m ) == 1

  z = x
  result = 1
  while z != 1:
    z = ( z * x ) % m
    result = result + 1
  return result
1141464
public function gexp(int $n):int{

		if($n < 0){
			$n += 255;
		}
		elseif($n >= 256){
			$n -= 255;
		}

		return Polynomial::table[$n][0];
	}
1159322
public static long count(int n, int m) {
		if(n == m) {
			return NumberUtil.factorial(n);
		}
		return (n > m) ? NumberUtil.factorial(n, n - m) : 0;
	}
1294918
static public function lcm($a, $b)
    {
        $a = abs($a);
        $b = abs($b);

        if ($a === 0 || $b === 0) {
            return 0;
        }

        $a = $a / self::gcd($a, $b);

        return $a * $b;
    }
699318
public static int gcd(int m, int n) {
    if (m == 0 && n == 0)
      return 0;
    if (m < n) {
      int t = m;
      m = n;
      n = t;
    }
    int r = m % n;
    if (r == 0) {
      return n;
    } else {
      return gcd(n, r);
    }
  }
1158425
function divInt_(x, n) {
  var i, r=0, s;
  for (i=x.length-1; i>=0; i--) {
    s=r*radix+x[i];
    x[i]=Math.floor(s/n);
    r=s%n;
  }
  return r;
}
708370
public static double[][] identity(final int m, final int n) {
    final double[][] A = new double[m][n];
    final int dim = m < n ? m : n;
    for(int i = 0; i < dim; i++) {
      A[i][i] = 1.0;
    }
    return A;
  }
219428
private static function powi($z, $n) {
        if ($n < 0) return static::div(1,static::powi($z, -$n));

        if ($n == 0) return new Complex(1,0);

        $y = new Complex(1,0);
        while ($n > 1) {
            if ($n % 2 == 0) {
                $n = $n / 2;
            } else {
                $y = static::mul($z, $y);
                $n = ($n-1)/2;
            }
            $z = static::mul($z, $z);
        }

        return static::mul($z, $y);
    }
987814
public static function gcd($a, $b) {
        return ($b == 0) ? ($a):(self::gcd($b, $a % $b));
    }
1327258
public function repeat(int $m = 1, int $n = 1) : self
    {
        if ($m < 1 or $n < 1) {
            throw new InvalidArgumentException('Cannot repeat less than 1'
                . ' row or column.');
        }

        $b = $this->a;

        $n -= 1;

        if ($n > 0) {
            foreach ($this->a as $i => $row) {
                for ($j = 0; $j < $n; $j++) {
                    $b[$i] = array_merge($b[$i], $row);
                }
            }
        }

        $c = [];

        for ($i = 0; $i < $m; $i++) {
            $c = array_merge($c, $b);
        }

        return self::quick($c);
    }
735433
static public function gcd($a, $b)
    {
        $a = abs($a);
        $b = abs($b);

        $k = max($a, $b);
        $m = min($a, $b);

        while ($m !== 0) {
            $r = $k % $m;
            $k = $m;
            $m = $r;
        }

        return $k;
    }
565385
private function findE($m)
    {
        $e = '3';
        if (bccomp($this->GCD($e, $m), '1') != 0) {
            $e = '5';
            $step = '2';
            while (bccomp($this->GCD($e, $m), '1') != 0) {
                $e = bcadd($e, $step);
                if ($step == '2') {
                    $step = '4';
                } else {
                    $step = '2';
                }
            }
        }

        return $e;
    }
19329
public static function gaussian(int $n) : self
    {
        if ($n < 1) {
            throw new InvalidArgumentException('The number of elements'
                . " must be greater than 0, $n given.");
        }

        $a = [];

        for ($i = 0; $i < $n; $i += 2) {
            $r1 = rand(0, PHP_INT_MAX) / PHP_INT_MAX;
            $r2 = rand(0, PHP_INT_MAX) / PHP_INT_MAX;
            
            $r = sqrt(-2. * log($r1));

            $a[] = $r * sin($r2 * self::TWO_PI);
            $a[] = $r * cos($r2 * self::TWO_PI);
        }

        if (count($a) > $n) {
            $a = array_slice($a, 0, $n);
        }

        return static::quick($a);
    }
239299
function rotl_64(x, n)
	{
		if (n > 32)
		{
			n = n - 32;
			return new Int_64(
				x.lowOrder << n | x.highOrder >>> (32 - n),
				x.highOrder << n | x.lowOrder >>> (32 - n)
			);
		}
		else if (0 !== n)
		{
			return new Int_64(
				x.highOrder << n | x.lowOrder >>> (32 - n),
				x.lowOrder << n | x.highOrder >>> (32 - n)
			);
		}
		else
		{
			return x;
		}
	}
92344
public static function lcm($a, $b)
    {
        return (abs($a * $b) / self::gcd($a, $b));
    }