Integer Math.Greatest Common Divisor Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
Overload List
Greatest | Returns the greatest common divisor of two integers. |
Greatest | Returns the greatest common divisor of two integers. |
Greatest | Returns the greatest common divisor of two integers. |
Greatest | Returns the greatest common divisor of two integers. |
Greatest | Returns the greatest common divisor of two integers. |
Greatest | Returns the greatest common divisor of two integers using the extended Euclidean algorithm. |
Greatest | Returns the greatest common divisor of two integers using the extended Euclidean algorithm. |
Greatest | Returns the greatest common divisor of two integers using the extended Euclidean algorithm. |
Greatest | Returns the greatest common divisor of two integers using the extended Euclidean algorithm. |
Greatest | Returns the greatest common divisor of two integers using the extended Euclidean algorithm. |
GreatestCommonDivisor(BigInteger, BigInteger)
Returns the greatest common divisor of two integers.
public static BigInteger GreatestCommonDivisor(
BigInteger a,
BigInteger b
)
Parameters
- a BigInteger
- An integer.
- b BigInteger
- An integer.
Return Value
BigIntegerThe greatest common divisor of a and b.
GreatestCommonDivisor(Decimal, Decimal)
Returns the greatest common divisor of two integers.
public static decimal GreatestCommonDivisor(
decimal a,
decimal b
)
Parameters
Return Value
DecimalThe greatest common divisor of a and b.
GreatestCommonDivisor(Int16, Int16)
Returns the greatest common divisor of two integers.
public static short GreatestCommonDivisor(
short a,
short b
)
Parameters
Return Value
Int16The greatest common divisor of a and b.
GreatestCommonDivisor(Int32, Int32)
Returns the greatest common divisor of two integers.
public static int GreatestCommonDivisor(
int a,
int b
)
Parameters
Return Value
Int32The greatest common divisor of a and b.
GreatestCommonDivisor(Int64, Int64)
Returns the greatest common divisor of two integers.
public static long GreatestCommonDivisor(
long a,
long b
)
Parameters
Return Value
Int64The greatest common divisor of a and b.
GreatestCommonDivisor(BigInteger, BigInteger, BigInteger, BigInteger)
Returns the greatest common divisor of two integers
using the extended Euclidean algorithm.
public static BigInteger GreatestCommonDivisor(
BigInteger a,
BigInteger b,
out BigInteger x,
out BigInteger y
)
Parameters
- a BigInteger
- An integer.
- b BigInteger
- An integer.
- x BigInteger
- On return, the coefficient of a.
- y BigInteger
- On return, the coefficient of b.
Return Value
BigIntegerThe greatest common divisor of a and b.
Remarks
The coefficients x and y are such that xa+yb=gcd(a,b).
GreatestCommonDivisor(Decimal, Decimal, Decimal, Decimal)
Returns the greatest common divisor of two integers
using the extended Euclidean algorithm.
public static decimal GreatestCommonDivisor(
decimal a,
decimal b,
out decimal x,
out decimal y
)
Parameters
- a Decimal
- An integer.
- b Decimal
- An integer.
- x Decimal
- On return, the coefficient of a.
- y Decimal
- On return, the coefficient of b.
Return Value
DecimalThe greatest common divisor of a and b.
Remarks
The coefficients x and y are such that xa+yb=gcd(a,b).
GreatestCommonDivisor(Int16, Int16, Int16, Int16)
Returns the greatest common divisor of two integers
using the extended Euclidean algorithm.
public static short GreatestCommonDivisor(
short a,
short b,
out short x,
out short y
)
Parameters
- a Int16
- An integer.
- b Int16
- An integer.
- x Int16
- On return, the coefficient of a.
- y Int16
- On return, the coefficient of b.
Return Value
Int16The greatest common divisor of a and b.
Remarks
The coefficients x and y are such that xa+yb=gcd(a,b).
GreatestCommonDivisor(Int32, Int32, Int32, Int32)
Returns the greatest common divisor of two integers
using the extended Euclidean algorithm.
public static int GreatestCommonDivisor(
int a,
int b,
out int x,
out int y
)
Parameters
- a Int32
- An integer.
- b Int32
- An integer.
- x Int32
- On return, the coefficient of a.
- y Int32
- On return, the coefficient of b.
Return Value
Int32The greatest common divisor of a and b.
Remarks
The coefficients x and y are such that xa+yb=gcd(a,b).
GreatestCommonDivisor(Int64, Int64, Int64, Int64)
Returns the greatest common divisor of two integers
using the extended Euclidean algorithm.
public static long GreatestCommonDivisor(
long a,
long b,
out long x,
out long y
)
Parameters
- a Int64
- An integer.
- b Int64
- An integer.
- x Int64
- On return, the coefficient of a.
- y Int64
- On return, the coefficient of b.
Return Value
Int64The greatest common divisor of a and b.
Remarks
The coefficients x and y are such that xa+yb=gcd(a,b).