Skip to content
← All questions

Do you have to continue the Euclidean algorithm until the remainder is exactly 0?

Strictly speaking, the standard stopping condition for the Euclidean algorithm is to continue until the remainder is 0. The last nonzero remainder is then the gcd. However, if you reach a remainder of 1, you already know the gcd must be 1, because 1 divides everything and no larger number can divide 1. The video demonstrates this by noting that reaching 1 makes the gcd obvious, but still writes the final step 17=17⋅1+017 = 17 \cdot 1 + 0 to satisfy the formal stopping rule.

Conditions

  • The inputs are natural numbers.
  • The Euclidean algorithm is being applied.

Reasoning, step by step

  1. Apply the division algorithm repeatedly.
  2. If a remainder of 1 is reached, the gcd is 1.
  3. To formally follow the algorithm's stopping condition, continue one more step to get a remainder of 0.
  4. Identify the last nonzero remainder as the gcd.

Example

In the example, the instructor reaches 18=1⋅17+118 = 1 \cdot 17 + 1. He notes the gcd is 1, but adds 17=17⋅1+017 = 17 \cdot 1 + 0 to complete the standard chain.

Common misconceptions

  • Believing the algorithm fails if you stop at 1; it is practically correct but formally incomplete.
  • Thinking you must always compute all steps even if the answer is obvious early on.

Watch the explanation

Connected concepts

Explore next

Related questions

Understand why

↗
Find a method

↗
Find a method

↗
Find a method

↗
Understand why

↗

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.