Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add parcadei/Continuous-Claude-v3 --skill modular-arithmetic -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/modular-arithmetic/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/modular-arithmetic/

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

Similar skills

All skills for AI and ML →

From the same set161

The whole set →
limits-colimits limits-colimits is a Claude Code skill that provides decision workflows for category theory limits and colimits, including Lean 4 proof formalization and SymPy calculations. CX Codex +1 ★ 3,951repo stars llm-tuning-patterns The llm-tuning-patterns skill recommends LLM settings for theorem proving, code generation, and creative work. Use it to choose token limits and temperature for a specific task. CX Codex +1 ★ 3,951repo stars research-codebase research-codebase — a subagent that automatically documents your codebase. It spawns specialized agents in parallel to locate files, analyze code logic, find usage patterns, and synthesize findings into a single technical report. CX Codex ★ 3,951repo stars search-tools search-tools is a Claude Code skill that routes code searches to LEANN, AST-grep, Morph, or Grep based on the task. CX Codex +1 ★ 3,951repo stars agentica-spawn agentica-spawn — a skill that spawns multi-agent patterns via Agentica: swarms for parallel research, hierarchies for role-based tasks, generator-critic loops for iterative refinement, and juries for consensus. CX Codex +1 ★ 3,951repo stars parallel-agent-contracts parallel-agent-contracts enforces type ownership rules across parallel agents in TypeScript projects, requiring grep checks and tsc verification before any subtask completes. CX Codex +1 ★ 3,951repo stars spark spark is a Claude Code subagent for small, focused code changes. It handles quick fixes and tweaks, then writes a summary to a project file. CX Codex ★ 3,951repo stars entropy A skill for Shannon entropy, conditional and differential entropy, KL divergence, and maximum entropy principle problems. CX Codex +1 ★ 3,951repo stars

Project sponsors

Companies that keep this analytics open