EuclidExtendedGreatestCommonDivisor(BigInteger, BigInteger, BigInteger, BigInteger) Method |
Computes the extended greatest common divisor, such that a*x + b*y = gcd(a,b).
Namespace: Altaxo.CalcAssembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax public static BigInteger ExtendedGreatestCommonDivisor(
BigInteger a,
BigInteger b,
out BigInteger x,
out BigInteger y
)
Parameters
- a BigInteger
- First Integer: a.
- b BigInteger
- Second Integer: b.
- x BigInteger
- Resulting x, such that a*x + b*y = gcd(a,b).
- y BigInteger
- Resulting y, such that a*x + b*y = gcd(a,b)
Return Value
BigIntegerGreatest common divisor
gcd(a,b)
Example long x,y,d;
d = Fn.GreatestCommonDivisor(45,18,out x, out y);
-> d == 9 && x == 1 && y == -2
The
gcd of 45 and 18 is 9: 18 = 2*9, 45 = 5*9. 9 = 1*45 -2*18, therefore x=1 and y=-2.
See Also