Mathematics · pattern A, Numeric fields
Enter two numbers for their greatest common factor, with each division step of Euclid's algorithm written out and the LCM alongside.
replace (a, b) with (b, a mod b) until b is zero
Euclid's algorithm is over two thousand years old and still the fastest general method. It needs only division with remainder.
21
For 252 and 105: GCF 21, LCM 1260.
1252 = 2 × 105 + 42
Euclid’s algorithm: replace the pair with (divisor, remainder)
2105 = 2 × 42 + 21
Euclid’s algorithm: replace the pair with (divisor, remainder)
342 = 2 × 21 + 0
Euclid’s algorithm: replace the pair with (divisor, remainder)
4GCF = 21
the last non-zero remainder is the greatest common factor
Each step replaces the pair with the divisor and the remainder, and the process terminates in a number of steps proportional to the digit count. Nothing faster is known for general integers, which is why it appears in every computer algebra system and in RSA key generation.
If the number is not the part you are stuck on, that is what the service is for — a specialist who explains the working, not just the answer.
Arithmetic runs in double-precision floating point, so results beyond about fifteen significant figures are not exact. Where a question wants an exact fraction or surd, keep the exact form rather than a decimal.