If you're seeing this message, it means we're having trouble loading external resources for Khan Academy.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Journey into cryptography

Modular arithmetic

  1. What is modular arithmetic?
  2. Modulo operator
  3. Modulo Challenge
  4. Congruence modulo
  5. Congruence relation
  6. Equivalence relations
  7. The quotient remainder theorem
  8. Modular addition and subtraction
  9. Modular addition
  10. Modulo Challenge (Addition and Subtraction)
  11. Modular multiplication
  12. Modular multiplication
  13. Modular exponentiation
  14. Fast modular exponentiation
  15. Fast Modular Exponentiation
  16. Modular inverses
  17. The Euclidean Algorithm
Next section:
Primality test
None

You're using a browser that doesn't support the features that we need in order to run the code of this page. Please switch your browser to one of the following in order for it to work correctly:

Chrome | Firefox | Safari