modular-arithmetic — Claude Code skill: graph number theory
A skill for Claude Code that handles modular arithmetic problems in graph number theory. Activates when you need the extended Euclidean algorithm, the Chinese remainder theorem, Euler's theorem, quadratic residues, or order of elements.
MIT ★ 3,951 updated 2026-01-26
npx skills add parcadei/Continuous-Claude-v3 --skill modular-arithmetic -a claude-codeWhat modular-arithmetic does
The skill covers five core strategies: the extended Euclidean algorithm finds modular inverses; the Chinese remainder theorem solves systems of congruences; Euler's theorem computes powers modulo n; quadratic residues check solvability using the Legendre symbol; order and primitive roots determine the multiplicative structure. Each maps to a command: sympy_compute.py solve for inverses, z3_solve.py prove for the Chinese remainder theorem, sympy_compute.py simplify for Euler's totient function. Only Bash and Read are enabled as tools.
Installs to Claude Code via npm: npx skills add places the skill at ~/.claude/skills/modular-arithmetic/SKILL.md.
What it helps with
- compute modular inverse for solving linear congruences
- solve systems of congruences with the Chinese remainder theorem
- calculate element exponents modulo n using Euler's theorem
- determine if a number is a quadratic residue
- find the multiplicative order of an element
Example prompts for the agent
- Find the modular inverse of 7 modulo 26
- Check whether x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7) has a solution
- Compute φ(p^k) for prime p and natural k
How to install modular-arithmetic
1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill modular-arithmetic -a claude-code2Manually: put the files in place
~/.claude/skills/modular-arithmetic/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/modular-arithmetic/
1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill modular-arithmetic -a codex2Manually: put the files in place
.agents/skills/modular-arithmetic/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill modular-arithmetic -a cursor2Manually: put the files in place
.cursor/skills/modular-arithmetic/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install parcadei/Continuous-Claude-v3 .claude/skills/math/graph-number-theory/modular-arithmetic2Manually: put the files in place
.github/skills/modular-arithmetic/SKILL.md1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill modular-arithmetic -a gemini-cli2Platform CLI
gemini skills install https://github.com/parcadei/Continuous-Claude-v3 --path .claude/skills/math/graph-number-theory/modular-arithmeticManually: put the files in place
.devin/skills/modular-arithmetic/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about modular-arithmetic
How do I install modular-arithmetic in Claude Code?
Run npx skills add parcadei/Continuous-Claude-v3 --skill modular-arithmetic -a claude-code. The skill installs to ~/.claude/skills/modular-arithmetic/SKILL.md.
What does the modular-arithmetic skill do?
It provides five strategies for modular arithmetic: the extended Euclidean algorithm, Chinese remainder theorem, Euler's theorem, quadratic residues, and multiplicative order. Each connects to a Python command that computes or verifies results.
What tools does this skill require?
The skill runs Bash commands and uses Read to access files. Python scripts sympy_compute.py and z3_solve.py execute through runtime.harness.
Source text
SKILL.md · MIT
---
name: modular-arithmetic
description: "Problem-solving strategies for modular arithmetic in graph number theory"
allowed-tools: [Bash, Read]
---
# Modular Arithmetic
## When to Use
Use this skill when working on modular-arithmetic problems in graph number theory.
## Decision Tree
1. **Extended Euclidean Algorithm**
- Find gcd(a,b) and x,y with ax + by = gcd(a,b)
- Modular inverse: a^{-1} mod n when gcd(a,n) = 1
- `sympy_compute.py solve "a*x == 1 mod n"`
2. **Chinese Remainder Theorem**
- System x = a_i (mod m_i) with coprime m_i
- Unique solution mod prod(m_i)
- `z3_solve.py prove "crt_solution_exists"`
3. **Euler's Theorem**
- a^{phi(n)} = 1 (mod n) when gcd(a,n) = 1
- phi(p^k) = p^{k-1}(p-1)
- `sympy_compute.py simplify "euler_phi"`
4. **Quadratic Residues**
- Legendre symbol: (a/p) = a^{(p-1)/2} mod p
- Quadratic reciprocity: (p/q)(q/p) = (-1)^{...}
- Tonelli-Shanks for square roots
5. **Order and Primitive Roots**
- ord_n(a) = smallest k with a^k = 1 (mod n)
- Primitive root: ord_n(a) = phi(n)
## Tool Commands
### Sympy_Mod_Inverse
```bash
uv run python -m runtime.harness scripts/sympy_compute.py solve "a*x == 1 mod n" --var x
```
### Z3_Crt
```bash
uv run python -m runtime.harness scripts/z3_solve.py prove "solution_exists_iff_pairwise_coprime"
```
### Sympy_Euler_Phi
```bash
uv run python -m runtime.harness scripts/sympy_compute.py simplify "phi(p**k) == p**(k-1)*(p-1)"
```
### Z3_Quadratic_Residue
```bash
uv run python -m runtime.harness scripts/z3_solve.py prove "legendre_symbol_multiplicative"
```
## Key Techniques
*From indexed textbooks:*
- [Graph Theory (Graduate Texts in Mathematics (173))] By N we denote the set of natural numbers, including zero. The set Z/nZ of integers modulo n is denoted by Zn; its elements are written as i := i + nZ. When we regard Z2 = {0, 1} as a eld, we also denote it as F2 = {0, 1}.
## Cognitive Tools Reference
See `.claude/skills/math-mode/SKILL.md` for full tool documentation.
© parcadei · MIT · parcadei/Continuous-Claude-v3