Math & Number Theory Essentials

  • GCD / LCM
  • Modular arithmetic
  • Fast exponentiation
  • Sieve of Eratosthenes
1 / 4

GCD / LCM

  • Euclid in O(log n)
  • lcm(a,b) = a/gcd(a,b)*b
2 / 4

Mod pow

  • Repeated squaring
  • O(log exp)
3 / 4

Sieve

  • Mark multiples
  • O(n log log n)
4 / 4
Use arrow keys or click edges to navigate. Press H to toggle help, F for fullscreen.