solve-modular-arithmetic
Installation
SKILL.md
Solve Modular Arithmetic
Solve modular arithmetic problems by parsing congruence systems, applying the extended Euclidean algorithm for inverses, using the Chinese Remainder Theorem for simultaneous congruences, and leveraging Euler's theorem for modular exponentiation. Verify every solution by substitution.
When to Use
- Solving a single linear congruence ax = b (mod m)
- Solving a system of simultaneous congruences (Chinese Remainder Theorem)
- Computing a modular inverse a^{-1} (mod m)
- Evaluating large modular exponentiations a^k (mod m)
- Determining the order of an element in Z/mZ
- Working with cyclic groups, primitive roots, or discrete logarithm contexts
Inputs
- Required: The congruence(s) or modular equation to solve
- Optional: Whether to show the extended Euclidean algorithm steps explicitly
- Optional: Whether Euler's theorem or Fermat's little theorem should be applied
- Optional: Whether to find primitive roots or element orders
Related skills