public void TestExtendedGreatestCommonDivisor(int rawA, int rawB, int rawX, int rawY) { var a = new BigInteger(rawA); var b = new BigInteger(rawB); var expectedX = new BigInteger(rawX); var expectedY = new BigInteger(rawY); (var gcd, var x, var y) = ExtendedEuclideanAlgorithm.GreatestCommonDivisor(a, b); Assert.That(x.Equals(expectedX)); Assert.That(y.Equals(expectedY)); }
/// <inheritdoc/> public override BigInteger Negate(BigInteger e) { (_, _, BigInteger r) = ExtendedEuclideanAlgorithm.GreatestCommonDivisor(Prime, e); r = (r + Prime) % Prime; return(r); }