Free · No sign-up · Data stays local

GCD and LCM Calculator

Enter any number of integers to get the greatest common divisor, the least common multiple and the prime factorisation of each number in one pass.

最大公约数 GCD
—
最小公倍数 LCM
—
数值个数
—
质因数分解

How to Use

  1. Enter the integers

    Type the numbers separated by commas, spaces or newlines — for example 12, 18, 24.

  2. Read the result

    The panel shows the GCD, the LCM and how many values were used, with the prime factorisation of each number listed below.

  3. Copy it out

    Click 'Copy result' to grab all three values plus the factorisations as plain text for homework, reports or code comments.

FAQ

How do GCD and LCM relate?

For positive integers a and b, a × b = gcd(a,b) × lcm(a,b). The tool computes the GCD first and divides, which also reduces the risk of overflow.

How are multiple numbers handled?

By pairwise reduction: gcd(a,b) first, then gcd of that with c, and so on. GCD is associative, so the order never changes the answer.

Why is factorisation limited to about 10^12?

Trial division probes every candidate up to √n, so cost grows with n. At 10^12 the square root is 10^6 — still milliseconds; beyond that it stalls and needs something like Pollard's rho.

Can I use 1 or negative numbers?

1 is fine — the GCD with 1 is always 1. This tool accepts positive integers only; negatives and zero are reported as invalid input.

More Online Tools