Extended GCD

Computes the Extended Euclidean Algorithm for integers a and b.

Input: TextResult: Text

Text input

Tool options

Examples

using input field for value a

Input

42

Expected answer

gcd: 7

Bezout coefficients:
x = 1
y = -1

Value a
(empty)
Value b
35
coprime numbers (3, 11)

Input

Expected answer

gcd: 1

Bezout coefficients:
x = 4
y = -1

Value a
3
Value b
11
hexadecimal input (0xFF, 0x11)

Input

Expected answer

gcd: 17

Bezout coefficients:
x = 0
y = 1

Value a
0xFF
Value b
0x11
large numbers

Input

Expected answer

gcd: 2

Bezout coefficients:
x = 12703973750415151
y = -1577756566311408967124629843

Value a
123456789012345678901234567890
Value b
994064509324197316
non-coprime numbers (240, 46)

Input

Expected answer

gcd: 2

Bezout coefficients:
x = -9
y = 47

Value a
240
Value b
46
with zero (17, 0)

Input

Expected answer

gcd: 17

Bezout coefficients:
x = 1
y = 0

Value a
17
Value b
0

Finds integers x and y (Bezout coefficients) such that: a*x + b*y = gcd(a, b) This is fundamental to many number theory algorithms including modular inverse, solving linear Diophantine equations, and cryptographic operations. Input handling: If either a or b is left blank, its value is taken from the Input field.

Format reference: Extended GCD background and specification

Parameters

ParameterDefault valueInput and choices
Value a""Text
Value b""Text

Related tools

Browse arithmetic / logic tools