maths.free › Number Theory › GCD and LCM
GCD and LCM
Euclid's algorithm and the identity gcd × lcm = a × b.
The greatest common divisor is found without factoring at all: replace the larger number by the remainder when it is divided by the smaller, repeat, and the last non-zero remainder is the gcd. That is Euclid's algorithm, 2,300 years old and still what your computer uses. The lcm follows from gcd × lcm = a × b.
Àwọn ààtò àwọn ìṣàmúlò-ètò · gcd(48, 18)
Àwọn ìṣàmúlò-ètò
- \gcd(48, 18)
Use Euclid's algorithm: replace the larger number by its remainder on division by the smaller, until the remainder is 0.
- 48 = 2 \times 18 + 12
Divide 48 by 18: quotient 2, remainder 12.
- 18 = 1 \times 12 + 6
Divide 18 by 12: quotient 1, remainder 6.
- 12 = 2 \times 6 + 0
Divide 12 by 6: quotient 2, remainder 0.
- \gcd(48, 18) = 6
The last non-zero remainder is 6.
Fi àwọn àgbèwọlé hàn
Nígbà yìí Yan àwọn àkóónú kan, tàbí tẹ̀ àtí kọ́ àwọn àkóónú rẹ̀. Àwọn ìṣàmúlò-ètò gbogbo, àwòrán, àwọn à
A free account adds notes on every lesson, a record of what you have finished, your solved problems in one place, and a tutor you can ask about this page. The maths itself is open to everyone, signed in or not.
Fikún Àwọn Ìṣàmúlò-ètòÀwọn àmì-ìwé tí a lo níbẹ̀
Tẹ àwọn àmì-ìwé fún ìṣàfarawé fún àwọn ìṣàmúlò-ètò, àwòrán, àti àwọn àmì-ìwé àwọn àmì-ìwé.
Bii o ṣe le: GCD and LCM
- Use Euclid's algorithm: replace the larger number by its remainder on division by the smaller, until the remainder is 0.
- Divide 48 by 18: quotient 2, remainder 12.
- Divide 18 by 12: quotient 1, remainder 6.
- Divide 12 by 6: quotient 2, remainder 0.
- The last non-zero remainder is 6.
Àwọn Àtòjọ-ẹ̀yàn
Why are primes so important?
Every integer factors into primes in exactly one way, so primes are the atoms of multiplication. Cryptography relies on that factoring being easy to state and hard to do.
How do I tell whether a big number is prime?
Trial division up to the square root works for small numbers. For large ones, probabilistic tests (Miller-Rabin) give an answer that is wrong with negligible probability, and deterministic tests (AKS) exist but are slower.
Diẹ̀ nínú Number Theory
Prime factorisationPrime numbersModular arithmeticDivisorsSequencesNumber basesDiophantine equationsFermat's little theorem and Euler's theoremRSA: cryptography from number theory