Returns the greatest common divisor of two integers
using the extended Euclidean algorithm.
Namespace:
Extreme.Mathematics
Assembly:
Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.1
public static long GreatestCommonDivisor(
long a,
long b,
out long x,
out long y
)
Public Shared Function GreatestCommonDivisor (
a As Long,
b As Long,
<OutAttribute> ByRef x As Long,
<OutAttribute> ByRef y As Long
) As Long
public:
static long long GreatestCommonDivisor(
long long a,
long long b,
[OutAttribute] long long% x,
[OutAttribute] long long% y
)
static member GreatestCommonDivisor :
a : int64 *
b : int64 *
x : int64 byref *
y : int64 byref -> int64
Parameters
- a
- Type: SystemInt64
An integer. - b
- Type: SystemInt64
An integer. - x
- Type: SystemInt64
On return, the coefficient of a. - y
- Type: SystemInt64
On return, the coefficient of b.
Return Value
Type:
Int64The greatest common divisor of
a
and
b.
The coefficients x and y
are such that
xa+yb=gcd(a,b).
Reference