Math Calculator

GCD & LCM Calculator

Common factors. Exact shared multiples.

Compare whole integers

Common factors. Exact multiples.

Two to twenty-five signed integers; commas, spaces, lines, semicolons or pipes. Up to 100 magnitude digits each.

View results

Calculation and report options

One to twenty when the LCM is positive. A zero LCM has only the zero common multiple.

UTF-8 numeric data, up to 64 KiB. Exported report CSV contains headers and is not an import template.

Worked examples

Fractions, decimals and exponent notation are rejected. Signs and leading zeros normalize exactly. Finite divisor enumeration is available when the positive GCD is at most 100,000,000. Larger GCDs retain exact results and certificates.

Exact GCD and LCM

gcd⁡=6\gcd=6lcm⁡=360\operatorname{lcm}=360

Exact GCD and positive LCM verified. Signs do not change either magnitude; source order and duplicates remain in the report.

Understand the list

GCD (also HCF or GCF) is reported nonnegative. LCM is positive for nonzero inputs and conventionally zero if any input is zero. Input signs do not change these magnitudes.

Collectively coprime

No: the whole-list GCD is not one.

Pairwise coprime

No: at least one pair has a GCD other than one.

A whole-list GCD of one does not by itself make every pair coprime. Use the optional pairwise report to inspect the difference.

Reduced signed ratio

3:4:103:4:10

Bézout and divisibility certificates

The exact linear combination equals the GCD. Its coefficients apply to the signed original inputs. Together with the divisibility checks this certifies the common divisor; coefficients are not unique. The all-zero identity does not assert a greatest positive divisor.

(−1)⋅(18)+(1)⋅(24)+(0)⋅(60)=6(-1)\cdot(18)+(1)\cdot(24)+(0)\cdot(60)=6

Input 1

a1=18a_{1}=18c1=−1c_{1}=-118=6⋅(3)18=6\cdot(3)360=(18)⋅(20)360=(18)\cdot(20)

Input 2

a2=24a_{2}=24c2=1c_{2}=124=6⋅(4)24=6\cdot(4)360=(24)⋅(15)360=(24)\cdot(15)

Input 3

a3=60a_{3}=60c3=0c_{3}=060=6⋅(10)60=6\cdot(10)360=(60)⋅(6)360=(60)\cdot(6)

Step-by-step Euclidean algorithm

Merge 1: combine the preceding GCD with the next magnitude. Remainders stay nonnegative. The final nonzero remainder is the new GCD; if the next magnitude is zero, no division is needed.

gcd⁡(18,24)=6\gcd(18,24)=6

Working page 1 of 1. Complete working for every merge remains in copy and CSV.

  1. Division 1

    18=0⋅24+1818=0\cdot24+18
  2. Division 2

    24=1⋅18+624=1\cdot18+6
  3. Division 3

    18=3⋅6+018=3\cdot6+0

LCM recurrence for this merge

The running LCM has its own GCD with the next magnitude. It is different from the running list GCD. A zero operand sets this LCM to zero without division.

lcm⁡(18,24)=186⋅24=72\operatorname{lcm}(18,24)=\frac{18}{6}\cdot24=72

Positive common divisors

These are all positive divisors of the exact GCD. The complete bounded list contains 44 values.

Divisor page 1 of 1. Total positive common divisors: 4. Copy and CSV retain the complete list.

11223366

First positive common multiples

Multiply the exact LCM by successive positive integers. The selected count changes this list only.

1L=3601L=3602L=7202L=7203L=10803L=10804L=14404L=14405L=18005L=1800
What Can You Create?

Create a complete common-factor and multiple record

Simplified integer relationships

Reduce an entire signed integer ratio by its nonnegative GCD, keeping zeros and signs where they belong. Compare the reduced components with the original list to see exactly what the shared factor removes. An all-zero list receives a dedicated explanation because dividing its ratio by the zero GCD is not a valid simplification.

Repeat-cycle and denominator checks

Use the positive LCM to identify a shared repeat count or common denominator when every input is nonzero. Inspect the first selected positive multiples as exact integers rather than rounded estimates. A zero input changes the question: the tool reports the conventional zero LCM and explains why there is no positive shared multiple in that case.

A checkable list-wide certificate

Keep the Euclidean divisions and signed Bézout coefficients with the final answer. The full report records every left-to-right merge and every independent pair, so it can be reviewed after compact panels are hidden. Source positions remain distinct, which matters when repeated values appear in a pairwise audit or when an input list has been deliberately reordered.

GCD and LCM formulas with step-by-step examples

For two integer inputs, write g=gcd⁡(a,b)≥0g=\gcd(a,b)\geq0. If both are nonzero, their least positive common multiple is L=∣a/g∣ ∣b∣L=|a/g|\,|b|. Division precedes multiplication, keeping the recurrence clear. If either input is zero, this calculator uses L=0L=0; if both are zero, it also uses g=0g=0. These computational conventions do not create a greatest positive divisor or a positive multiple for an all-zero list.

Follow Euclid on a signed pair

Normalize the magnitudes, divide until the remainder becomes zero, and retain the final nonzero remainder. Restore the original signs only when forming the coefficient certificate.

24=1⋅18+6,18=3⋅6+024=1\cdot18+6,\qquad18=3\cdot6+0

Check the pair product and linear combination

The GCD and LCM reproduce the absolute product for two numbers. A separate signed linear combination verifies that the common divisor is attained by integer coefficients.

gcd⁡(−18,24)=6,lcm⁡(−18,24)=72\gcd(-18,24)=6,\quad\operatorname{lcm}(-18,24)=72

Extend by separate recurrences

Merge the first two magnitudes, then include the next input. The LCM denominator is the GCD of the running LCM and the new magnitude, rather than the running list GCD.

gcd⁡(18,24,60)=6,lcm⁡(18,24,60)=360\gcd(18,24,60)=6,\quad\operatorname{lcm}(18,24,60)=360

Distinguish collective and pairwise tests

No factor greater than one divides all three inputs, but each of the three pairs shares a different factor. This is a useful counterexample to an overly strong coprimality conclusion.

gcd⁡(6,10,15)=1,gcd⁡(6,10)=2,gcd⁡(10,15)=5\gcd(6,10,15)=1,\quad\gcd(6,10)=2,\quad\gcd(10,15)=5
(1)(−18)+(1)(24)=6,∣(−18)(24)∣=6⋅72=432(1)(-18)+(1)(24)=6,\qquad|(-18)(24)|=6\cdot72=432

For a list, initialize G1=∣a1∣G_1=|a_1| and L1=∣a1∣L_1=|a_1|. Continue with Gk=gcd⁡(Gk−1,∣ak∣)G_k=\gcd(G_{k-1},|a_k|) and Lk=lcm⁡(Lk−1,∣ak∣)L_k=\operatorname{lcm}(L_{k-1},|a_k|). Euclid uses A=qB+rA=qB+r with 0≤r<B0\leq r<B whenever B>0B>0. Extended Euclid supplies coefficients satisfying ∑iciai=Gn\sum_i c_i a_i=G_n. A positive integer is a common divisor of the list exactly when it divides GnG_n; this equivalence also explains the infinite common-divisor set when every input is zero.

These identities provide distinct checks. Divisibility alone shows that a candidate is common, while the Bézout combination confirms that no larger positive common divisor can divide all inputs when the result is positive. The LCM recurrence establishes the least-positive property for nonzero lists; merely finding a large number divisible by every input would establish a common multiple without proving that it is the least one.

Why Users Love This Tool

Keep every integer exact and every inference specific

Exact values and explicit conventions

  • Integer source strings use BigInt arithmetic, preserving adjacent large integers beyond native floating-point precision. A fractional or malformed token cannot silently become a different integer question.
  • Nonnegative GCD and LCM magnitudes are separate from signed ratio components and signed Bézout coefficients. Zero explanations avoid division by zero and distinguish a convention from a positive-number extremum.
  • The computation does not depend on complete prime factorization. Exact Euclidean answers remain available for supported large inputs even when enumerating their common divisors is intentionally withheld.

Verification you can reproduce

  • Inspect one merge at a time, including its Euclidean quotient and remainder rows and its separate LCM recurrence. Changing the visible page never changes the verified result or the full exported working.
  • Compare collective coprimality with every indexed pair. Input duplicates are retained unless explicitly removed, while sorting or using magnitudes are deliberate input edits with immediately recomputed certificates.
  • Share the numerical source and report settings, retain a complete CSV, or print a focused report. Invalid imports leave existing data intact, and invalid edits disable result actions instead of copying a stale answer.
Perfect For

Useful for number sense, exact arithmetic and repeated cycles

Students learning divisibility

Connect common factors, simplified ratios and common multiples with the actual Euclidean remainders. Compare a pair with a longer list before applying a product identity, and use a counterexample to understand why collective and pairwise coprimality must be distinguished.

Teachers preparing worked answers

Show a chosen merge without overwhelming a small screen with every division at once. Keep the full Bézout and pairwise audit in downloadable working, and use signed and zero examples to make the scope of familiar positive-integer rules explicit.

Technical readers checking integer cycles

Calculate an exact repeat count for nonzero integer periods or inspect a large common scale factor without rounded notation. The tool works with discrete counts, not measurements with uncertainty, unit conversion, calendars or practical scheduling constraints.

How It Works

How it works in three quick steps.

1

Enter the complete integer list

Enter between two and twenty-five signed whole-number decimals, using spaces, lines, commas, semicolons or pipes to separate them. Keep grouping commas out of individual values: a comma starts another input rather than marking thousands. Decimals, fractions, exponent notation and empty delimiter cells are rejected. Every integer supports up to one hundred magnitude digits without conversion to native floating-point numbers.

2

Read the exact GCD and LCM

Compare the nonnegative GCD with the positive LCM, or read the special zero convention when any input is zero. Inspect the reduced signed ratio and distinguish a whole-list GCD of one from pairwise coprimality. Select a merge to follow the Euclidean divisions and the separate running-LCM recurrence. The order of merging can change the working but does not change either final magnitude.

3

Verify, explore and keep the report

Check the signed-input Bézout coefficients and the divisibility identities. Turn on the pairwise report, browse bounded common divisors and choose how many positive common multiples to list. Copy the complete explanation or result LaTeX, download all working as CSV, share the input and report options, or print the visible report. Complete exports retain working and pairs outside the current visual page.

Download & Print

Save complete working or print a focused explanation

Copy exact values and notation

Copy summary retains every Euclidean division, all merge results, indexed pairs and the complete generated common-divisor list even if panels are hidden. Copy LaTeX provides the exact GCD, LCM and signed Bézout expressions for a mathematics document. The visual page selector controls browsing, not the content of the complete text report.

Download an exact CSV report

A rectangular four-column CSV separates record type, input or merge position, label and value. One divisor or pair result is stored per row rather than filling a single oversized spreadsheet cell. Long integer cells are marked as text to prevent spreadsheet software from rounding their last digits. Keep that text marker when reviewing exported exact values.

Print or save a readable PDF

Use Print / Save PDF after selecting the working and pair pages you want to explain. The report retains the zero convention, headings and mathematical notation while removing navigation and editable controls. Very long expressions use explicit print notices; the on-screen mathematics, complete copy and CSV retain the exact values. Print at actual size or a readable scale and check the preview before saving.

FAQ

Frequently Asked Questions

Are GCD, GCF and HCF different calculations?
For the integer lists supported here, greatest common divisor, greatest common factor and highest common factor name the same nonnegative result. A positive result divides every input without a remainder. The tool accepts signed integers but normalizes the divisor's sign. An all-zero list needs an explicit convention: its reported GCD is zero, while there is no greatest positive common divisor because every positive integer divides every zero in that list.
What happens when one or every input is zero?
With at least one nonzero input, zeros do not change the common positive divisors of the other values. A list containing zero has no positive common multiple, because an integer multiple of zero is always zero. The conventional LCM is therefore reported as zero. For an all-zero list the conventional GCD is also zero, and the tool explains that the common positive-divisor set is infinite instead of displaying a misleading finite list.
Do negative signs change the GCD or LCM?
The reported GCD and LCM depend on the positive magnitudes, so changing a sign does not change those two values. Signs still matter in the signed reduced ratio and in the Bézout identity. The coefficients shown by the calculator multiply the original signed inputs, not merely their absolute values. This keeps the verification mathematically consistent while allowing the Euclidean divisions themselves to use nonnegative magnitudes and remainders.
Why does a whole-list GCD of one not imply pairwise coprimality?
A collective GCD of one means no positive integer greater than one divides every input simultaneously. Pairwise coprimality is stronger: each distinct pair of input positions must have GCD one. A list can pass the first test while different pairs share different factors. The tool checks every pair and preserves duplicate input positions, so a repeated value can affect pairwise status even though duplication does not change the final whole-list GCD or LCM.
Can I multiply the GCD and LCM to get the product of an entire list?
The familiar absolute-product identity applies to a pair of integers under the stated zero conventions. It is not a general product formula for three or more inputs. For a longer list, compute the GCD and LCM by their separate left-to-right recurrences. The running LCM must use its own GCD with the next magnitude. Reusing the whole-list running GCD in that LCM denominator can give an incorrect answer, even when each intermediate number looks plausible.
How do the Euclidean steps and Bézout coefficients verify a result?
Each Euclidean row divides one nonnegative magnitude by another and records its quotient and remainder. Replacing the pair by the divisor and remainder preserves their common divisors until a zero remainder terminates the process. Extended Euclid also produces integer coefficients whose linear combination of the signed inputs equals the reported GCD. Together with the divisibility identities this is an exact certificate. Coefficients are not unique, so another valid calculation can use different coefficients.
Why are some common-divisor lists or printed expressions limited?
Exact GCD and LCM calculation does not require listing every divisor or factoring large integers. Complete common-divisor enumeration is enabled only when the positive GCD is at most one hundred million. Larger results keep exact values and verification identities without claiming a truncated list is complete. Long expressions scroll on screen and remain available in complete copies and CSV. A narrow printed report uses an explicit notice where a long expression would otherwise clip digits.
What can I import, share, copy and download?
Local import accepts numeric UTF-8 text or CSV within the file and input limits, preserving signed values, duplicates and source order. It does not accept the generated report CSV as a numeric template because that report contains headings and explanatory fields. Shared links retain the input and report options, while browsing positions are local. Complete copies and CSV include every merge, Euclidean division and pair result regardless of hidden panels or pagination. Printing follows the current visible working, divisor and pair pages.
About This Tool

About this GCD & LCM Calculator

The GCD & LCM Calculator turns a signed integer list into an exact, reviewable arithmetic record. Its purpose is broader than returning two values: the result connects divisibility, reduced ratios, repeat multiples and integer linear combinations while naming the assumptions that make each interpretation valid. The source stays textual until strict integer parsing, and BigInt arithmetic keeps all supported digits intact. There is no decimal truncation or approximate least common multiple hidden behind a formatted number.

The computational method uses Euclid's algorithm and its extended form. That choice matters because finding a common divisor does not require discovering every prime factor of a large integer. The calculator can therefore retain exact GCD and LCM results beyond its intentionally small common-divisor enumeration domain. Positive common divisors are completely listed only within the stated bound. An all-zero list instead has an infinite common positive-divisor set, and the report preserves that distinction rather than presenting an empty list as the answer.

For longer lists, the tool folds the inputs in their original order. Intermediate divisions and one valid Bézout coefficient set can change after reordering, although the final GCD and LCM do not. Pairwise checks keep original input positions distinct, including duplicates. The reduced ratio retains the original signs, while GCD and LCM use their standard nonnegative normalization. Local imports, explicit list transformations and shareable settings support reproducible examples. Complete copied and downloaded working retain detail beyond a compact screen view, while the print report follows the selected visual pages and explains any long-expression fallback.

Editorial Transparency

Who maintains this page

Ownership and review

Written and maintained by the Toolarithm editorial team. No review date is shown without a maintained editorial record. No independent professional review is claimed.

Methodology

Equations are checked by substituting worked examples into the stated relationship and comparing the result with the interactive implementation.

Read the editorial methodology

Dates and sources

Review dates change only after a substantive method or content check.

Keep building

Explore more calculators

Calculators hub