Extended GCD and divisibility over ℤ #
Main definitions #
- Given
x y : ℕ
,xgcd x y
computes the pair of integers(a, b)
such thatgcd x y = x * a + y * b
.gcdA x y
andgcdB x y
are defined to bea
andb
, respectively.
Main statements #
gcd_eq_gcd_ab
: Bézout's lemma, givenx y : ℕ
,gcd x y = x * gcdA x y + y * gcdB x y
.
Tags #
Bézout's lemma, Bezout's lemma
Extended Euclidean algorithm #
@[simp]
theorem
Nat.xgcd_zero_left
{s : ℤ}
{t : ℤ}
{r' : ℕ}
{s' : ℤ}
{t' : ℤ}
:
Nat.xgcdAux 0 s t r' s' t' = (r', s', t')
Divisibility over ℤ #
@[deprecated Int.gcd_natCast_natCast]
Alias of Int.gcd_natCast_natCast
.