Skip to content
OddsockLocal
Local

GCD2

LCM
12
GCD: 2Runs in this browser. Nothing is uploaded.

Ready

How to use

  1. Enter two whole numbers.
  2. Read the GCD. It is the last non-zero remainder of the Euclidean algorithm.
  3. Read the LCM. It is |a × b| / GCD when the GCD is not zero.

What is GCD and LCM?

The greatest common divisor of 4 and 6 is 2, the largest positive integer that divides both. The least common multiple is 12, the smallest positive integer that both divide. They are tied together: for two non-zero integers, |a × b| = GCD × LCM. Check it: 4 × 6 is 24, and 2 × 12 is 24.

Read more

The divisor comes from the Euclidean algorithm. Divide 6 by 4, remainder 2. Divide 4 by 2, remainder 0. The last non-zero remainder is the GCD. The LCM is then the product of the absolutes divided by that GCD, computed with exact integers so a large pair does not lose digits. Signs are ignored for both results. The GCD of −4 and 6 is still 2.

If either value is 0, the GCD is the absolute value of the other one, and the LCM is 0. Two zeros give GCD 0 and LCM 0. Both inputs have to be whole numbers. A fraction belongs on the fraction page, where the GCD is used quietly to reduce a result.

Use cases

  • A student reducing a ratio or a fraction and needing the shared divisor of 4 and 6.
  • A teacher showing that GCD times LCM recovers the product of the two numbers.
  • A scheduler finding the first minute when a 4-minute cycle and a 6-minute cycle meet.
  • A programmer checking an LCM that would overflow a casual floating-point multiply.
  • Someone confirming the GCD of a negative and a positive is the same as for the absolutes.

4 and 6

First value 4. Second value 6.

GCD 2. LCM 12. The product 24 equals 2 × 12.

Why use Oddsock

Oddsock runs this in your browser. It is free, it does not upload the work, and it does not ask for an account.

Related tools

Using this tool

6 divided by 4 leaves remainder 2. 4 divided by 2 leaves remainder 0. The GCD is 2.