JESUS CHRIST IS THE ONLY TRUE GOD
Math calculator

Euclidean Algorithm Calculator

Calculate the greatest common divisor of two integers using Euclid’s algorithm.

Your calculationPrivate in your browser

How to use the euclidean algorithm calculator

  1. Prepare the values for this calculation

    Calculate the greatest common divisor of two integers using Euclid’s algorithm. Use the formula below to check that it answers your question. Read the input units before transferring figures from a statement, measurement or dataset.

  2. Enter and check each input

    • First integer: enter a value a whole number. Use the unit named in the label or selected above. Do not leave this required field blank.
    • Second integer: enter a value a whole number. Use the unit named in the label or selected above. Do not leave this required field blank.

    The input table gives a complete example. Keep units and time periods consistent across related fields.

  3. Calculate and resolve any input error

    Choose Calculate after entering the values. Changes also update the answer after a short pause. If an error appears, follow its message, correct the field and calculate again. Reset restores the example values.

  4. Interpret the answer

    Check Greatest common divisor first. With the unchanged example inputs, it is 21. Interpret it using the formula and assumptions on this page.

  5. Compare and keep a useful result

    For a controlled comparison, keep every other example input unchanged and change First integer from 252 to 278. The resulting Greatest common divisor is 1. This illustrates the equation’s response to that input, rather than a forecast of real events.

    Read the chart’s axis labels and data table. A scenario curve changes one stated input while holding the others fixed; it does not add external observations. Use Download graph to save an available chart as a PNG.

    Use Copy result or Download CSV to keep the answer. Share tool shares the page address without placing your input values in the URL. Recheck inputs and assumptions before using the result for a decision.

Euclidean Algorithm Calculator formula

Repeatedly replace (a,b) with (b,a mod b) until b=0.

Inputs and units

Inputs and example values for Euclidean Algorithm Calculator
InputFormat / rangeExample
First integerNumber; whole number252
Second integerNumber; whole number105

Worked example

Using the example inputs above, the greatest common divisor is 21.

Greatest common divisor
21

Results and assumptions

The output uses the greatest common divisor convention and formula shown above. Match the entered units and source assumptions when comparing results.

Fix an input or unexpected result

First integer is required. Enter first integer using the format and bounds in the input table. Zero and an empty field are different: use zero only if it is allowed and represents your data.

If your answer differs from the example, choose Reset and compare every field, including selected units and options. Check percentage versus decimal entry and whether values describe the same period. Round only the final displayed answer when reproducing the formula.

If a discrepancy remains, report the calculator issue with the page address, non-sensitive example inputs, actual result, expected result and a reference for your calculation.