How does Euclid’s algorithm find the greatest common factor?
Euclid’s algorithm repeatedly replaces a pair by the smaller value and the remainder from division. The final nonzero remainder is the GCF.
Reduce the pair without changing its common divisors
Any number dividing both original inputs also divides their remainder after one is subtracted a whole number of times from the other. The reverse relationship holds too, so each replacement preserves the common-divisor problem while making the numbers smaller.
Worked example
For 84 and 30, 84 ÷ 30 leaves 24. Next 30 ÷ 24 leaves 6, and 24 ÷ 6 leaves zero. The last nonzero value is 6. Check the result: 84 ÷ 6 = 14 and 30 ÷ 6 = 5, both whole numbers.
Remember which value finishes the procedure
Zero is the stopping remainder, not the GCF. The preceding divisor supplies the result. Calculator ForEver runs this positive-integer procedure and rejects unsupported decimal or negative inputs rather than choosing a different convention for them.
Use each remainder to form the next pair
Euclid’s algorithm repeatedly divides the larger integer by the smaller and keeps the remainder. Replace the pair with the previous smaller number and that remainder. This reduces the numbers while preserving their common divisors. When a division leaves a remainder of zero, the divisor used in that final division is the GCF. The zero itself is not the answer. Writing the dividend, quotient, divisor and remainder in each line makes the stopping rule easier to follow than a list of subtractions.
Trace a complete example with small remainders
For 252 and 105, write 252 = 2 × 105 + 42. The next step is 105 = 2 × 42 + 21. Then 42 = 2 × 21 + 0, so GCF(252,105) = 21. Verify by dividing the original inputs: 252 ÷ 21 = 12 and 105 ÷ 21 = 5. The reduced pair 12 and 5 has no common factor greater than one. This gives both a calculation and a check that the original pair has been reduced fully.
Explain why the replacement preserves common divisors
If a number divides both 252 and 105, it also divides their difference after removing two copies of 105: the remainder 42. Conversely, a divisor of 105 and 42 divides 2 × 105 + 42, which reconstructs 252. Thus the pair 252,105 and the pair 105,42 have the same common divisors. Repeating that relationship justifies the algorithm rather than treating it as a mysterious sequence. It also shows why exact integer remainders matter; rounded decimal remainders would not preserve the same divisibility statement.
Handle an exact first division without extra steps
If the larger input is an exact multiple of the smaller, the first remainder is zero and the smaller input is the GCF. For 24 and 96, divide 96 by 24 to get four with remainder zero, so the answer is 24. Equal positive inputs behave similarly. Calculator ForEver’s interface restricts its GCF inputs to positive whole numbers, so these cases fit the supported domain. A manual method may define conventions for zero or negative inputs, but those conventions should not be assumed to match a form that rejects them.
Questions about this calculation
Does the order of the inputs matter?
No. Swapping the two positive inputs changes the early division steps but leaves the set of common divisors, and therefore the GCF, unchanged.
Try these values in the calculator
Find the largest factor shared by two positive integers.
Use the greatest common factor calculator