Euclidean Algorithm Calculator & Bézout Solutions
Inspect each quotient and remainder and see its coefficients relative to the original inputs. Use the final Bézout identity to find all integer pairs, then check whether the nonnegative pairs are finite, infinite or empty.
Follow the Euclidean algorithm step by step
Find the greatest common divisor and Bézout coefficients, then count the nonnegative integer pairs that reach a target.
Integers and target
Enter a and b for the divisor and remainder steps. Add c to solve ax + by = c over integer pairs.
GCD 6. The target has 3 nonnegative pairs.
Common divisor and multiple
- Greatest common divisor
- 6
- Least common multiple
- 420
- Bézout identity
- (-1) × (84) + (3) × (30) = 6
Quotient and remainder replay
Division 1 of 3. Use this remainder as the next divisor.
84 = 2 × 30 + 24
- Divisible portion
- 60
- Remainder
- 24
Remainder = (1) × (84) + (-2) × (30)
Integer solutions
The target has 3 nonnegative pairs.
- x for integer k
- -198 + 5k
- y for integer k
- 594 − 14k
- k for nonnegative pairs
- 40 to 42
- Nonnegative pair count
- 3
Each bar shows the share of x and y within one displayed pair.
k = 40
- x
- 2
- y
- 34
k = 41
- x
- 7
- y
- 20
k = 42
- x
- 12
- y
- 6
x unitsy units
Export the integer worksheet
Save the exact division steps, remainder coefficients and nonnegative solution bounds.
View CSV text
How to use this calculator
- Enter the two integers. Add a signed target if you want to solve ax + by = c.
- Read the GCF, LCM and Bézout coefficients. Move through the remainder steps to see where the coefficients come from.
- Check the integer family and the exact parameter bounds for nonnegative pairs.
- Download the worksheet for every division and the exact solution summary.
The Formula
The mathematical logic powering this calculation is:
Start with |a| and |b|. At each step write dividend = quotient × divisor + remainder, where 0 ≤ remainder < divisor. Continue with the divisor and remainder. The last nonzero magnitude is g = gcd(a,b). The least common multiple is |(a/g)b| when g is positive and is zero if either input is zero. This worksheet uses gcd(0,0) = 0.
Express each remainder as s·a+t·b by applying the same subtraction to the coefficients. The final nonzero row gives s·a+t·b=g, using the original signed inputs. If both values are zero, the calculator uses the coefficient pair (0,0).
With a nonzero gcd, an integer target c is reachable exactly when g divides c. One pair is x₀=s(c/g), y₀=t(c/g). Every integer pair is x=x₀+(b/g)k, y=y₀−(a/g)k for integer k. Impose x ≥ 0 and y ≥ 0 by rounding the lower parameter bounds up and the upper bounds down. A finite inclusive window contains one plus its upper endpoint minus its lower endpoint pairs. For a=b=0, all pairs work only when c=0.
Enter signed integers with up to 36 digits. The target is optional. The diagrams show a selected division and representative nonnegative pairs. All counts, arithmetic, bounds and exported values are exact integers.Worked Example
If you input:
- a: 84
- b: 30
- c: 1188
Result:
The GCF is 6 and the LCM is 420. Bézout gives −84 + 3 × 30 = 6. The target has three nonnegative pairs (2,34), (7,20) and (12,6).
Frequently Asked Questions
Why does the Euclidean algorithm stop?
Each positive remainder is smaller than its previous divisor. Eventually the remainder is zero, and the preceding positive divisor is the GCF.
Can a target have integer solutions but no nonnegative solution?
Yes. Divisibility by the GCF guarantees an integer pair. Both quantities can be nonnegative only if their individual parameter bounds overlap.
Can I use negative inputs?
Yes. Divisions use input magnitudes. The Bézout coefficients correspond to the original signed inputs, and the target equation uses those signs.
Are all solution pairs shown?
The parameter interval gives the complete family. Up to five representative nonnegative pairs appear so very large or infinite families can be inspected.
Similar Calculators
GCF Calculator
Find the greatest common factor (GCF) of two or more integers.
Linear Congruence Calculator & Solution Timeline
Solve one or more linear congruences ax ≡ b (mod m). Find the common residue and period, or see why the congruences conflict.
Divisibility Rules Calculator & Missing Digits
Test a whole number against several divisors or solve for missing digits. See exact match counts, possible digits and a step-by-step remainder trace.
