Number theory: gcd and modular arithmetic

Sign up free to unlock this topic

Kindergarten is free, and guests can try one sample topic in every other grade. A free parent or teacher account opens every topic from Kindergarten to Grade 12, college and university, and saves progress. No credit card.

Try the free sample: The ideal gas law · Have a class or homeroom code? Join here

Key idea: Number theory: gcd and modular arithmetic

The Euclidean algorithm finds gcd(a, b) by repeating gcd(b, a mod b). In modular arithmetic you only keep remainders; powers repeat in cycles, which makes huge exponents easy.

Key words

gcd
Last non-zero remainder.
Inverse mod m
Exists when gcd(a, m) = 1.

🔎 What to look for: Reduce at every step so the numbers stay small.

Zero2Hero — Zéro2Héros