vmbo havo vwo

GCD and LCM calculator

Quick answer

The gcd (greatest common divisor; Dutch: GGD) is the largest whole number that divides both values. The lcm (least common multiple; Dutch: KGV) is the smallest positive common multiple.

For 12 and 18: gcd = 6 (because 18 = 1 × 12 + 6, then 12 = 2 × 6 + 0). lcm = |12 × 18| ÷ 6 = 36.

Calculator

Two whole numbers of 0 or greater. gcd(0, 5) = 5; gcd(0, 0) is not defined. Choose gcd or lcm mode; the steps use Euclid’s algorithm (division with remainder).

What are gcd and lcm?

The gcd of two whole numbers is the largest number that divides both. Factorising: 12 = 2 × 2 × 3 and 18 = 2 × 3 × 3 share 2 × 3 = 6. In class you usually use division with remainder (Euclid): keep dividing until the remainder is 0; the last divisor is the gcd. Map ratios reuse that gcd on the scale calculator; the topic hub is numbers and ratios.

The lcm is the smallest positive number that is a multiple of both. Formula: lcm(a, b) = |a × b| ÷ gcd(a, b). That is the same gcd you use when you simplify a fraction. Percent of a whole is a different tool: the percentage calculator.

When to use gcd, when to use lcm
Question in the exercise Choose School example
Write as small as possible / common factor gcd 12/18 → divide by 6 → 2/3
Least common denominator / “when again at the same time” lcm 1/2 + 1/3 → denominator 6; buses every 12 and 18 min → 36

Three numbers: first gcd of the first pair, then gcd of that result and the third. No separate mode here.

How to find the gcd with Euclid’s algorithm

  1. Divide the larger number by the smaller. 48 = 2 · 18 + 12.
  2. Repeat with the divisor and the remainder. 18 = 1 · 12 + 6, then 12 = 2 · 6 + 0.
  3. The last non-zero remainder is the gcd. gcd(48, 18) = 6, so lcm(48, 18) = 48 · 18 ÷ 6 = 144.
GCD and LCM of common number pairs
NumbersGCDLCM
12 and 18636
8 and 12424
15 and 25575
24 and 361272
21 and 497147
35 and 427210
40 and 10020200
48 and 6012240

Examples by level

Dutch secondary tracks appear as badges here once: vmbo (practical), havo (middle), vwo (pre-university). Euclid and the lcm formula stay the same; only the examples get denser.

gcd of 12 and 18

  1. Order18 and 12
  2. First remainder18 = 1 × 12 + 6
  3. Second remainder12 = 2 × 6 + 0
  4. gcd6

Common mistakes

Wrong

Mixing gcd and lcm: calling 36 the gcd of 12 and 18.

Right

gcd is smaller (or equal): 6. lcm is larger (or equal): 36.

Wrong

Taking the lcm as a + b, or as the product without dividing by the gcd.

Right

First gcd, then |a × b| ÷ gcd. 216 ÷ 6 = 36, not 216.

Wrong

Entering decimals, such as 12.5.

Right

gcd and lcm belong to whole numbers. Use an integer of 0 or greater.

Wrong

Writing gcd(0, 0) as 0 or as 1.

Right

gcd(0, 0) is not defined. gcd(0, 5) = 5 is fine.

Practice

vmbo What is gcd(8, 12)?

vmbo What is lcm(8, 12)?

havo Simplify 12/18. Which gcd do you use?

havo gcd(0, 9)?

vwo gcd of 12, 18 and 30. How do you handle three numbers?

In class

On vmbo, gcd is mainly for simplifying fractions and “equal pieces”. lcm returns as the least common denominator. Division with remainder is the same operation as on the division with remainder calculator.

GCD and LCM are in this one calculator: it is about the same two whole numbers, and the two answers are linked through the GCD.

Next step

Learning path

Frequently asked questions

How do you find the gcd of 12 and 18?

18 = 1 × 12 + 6, 12 = 2 × 6 + 0. gcd = 6.

How do you find the lcm?

lcm = |a × b| ÷ gcd. 12 × 18 = 216, 216 ÷ 6 = 36.

What is gcd(0, 5)?

5. gcd(0, 0) is not defined.

How does gcd appear in fractions?

Simplifying divides numerator and denominator by their gcd. Open the fraction calculator.

When do you choose gcd and when lcm?

Use gcd to simplify or pull out a common factor. Use lcm for the least common denominator or “when do they meet again”.

What is the gcd of 21 and 49?

7. Euclid: 49 = 2 · 21 + 7 and 21 = 3 · 7 + 0, so the last non-zero remainder is 7. The lcm is 21 · 49 ÷ 7 = 147.

Can the lcm be smaller than both numbers?

No. The lcm is a multiple of both numbers, so it is at least as large as the larger one.

Related tools