gcd ( x y -- a d )
Factor handbook > The language > Numbers > Mathematical functions > Integer functions

Prev:align ( m w -- n )
Next:log2 ( x -- n )


Vocabulary
math

Inputs and outputs
xan integer
yan integer
aan integer
dan integer


Word description
Computes the positive greatest common divisor d of x and y, and another value a satisfying:
a*y = d mod x


Notes
If d is 1, then a is the inverse of y modulo x.

Definition