gcd method

BinaryPolynomial gcd(
  1. BinaryPolynomial other
)

Returns the greatest common divisor of this polynomial and other.

Implementation

BinaryPolynomial gcd(BinaryPolynomial other) {
  var a = this;
  var b = other;
  while (!b.isZero) {
    final remainder = a % b;
    a = b;
    b = remainder;
  }
  return a;
}