GCD/LCM via the Euclidean algorithm; primality via trial division or the Sieve of Eratosthenes for bulk prime generation; modular arithmetic for large-number problems.
Sub-patterns
- A — GCD/LCM. The Euclidean algorithm.
- B — Sieve of Eratosthenes. Bulk prime generation.
- C — Modular Exponentiation. Fast exponentiation under a modulus for large-number problems.
- D — General Math Puzzles. One-off number-theory or arithmetic problems.
Practice set (7)
- Easy — Fizz Buzz, Happy Number, Roman to Integer, Excel Sheet Column Number
- Medium — Count Primes, Pow(x, n), Fraction to Recurring Decimal
Pending
GCD/LCM
The Euclidean algorithm for greatest common divisor and least common multiple.
Pending
Sieve of Eratosthenes
Bulk prime generation up to a bound, faster than trial-dividing each candidate.
Pending
Modular Exponentiation
Fast exponentiation under a modulus, for large-number problems.
Pending
General Math Puzzles
One-off number-theory or arithmetic problems that don't fit a larger pattern.
Notes from readers
Comments — via GitHub