Skip to content
Back to skills

Modular Arithmetic

ASecurity

Problem-solving strategies for modular arithmetic in graph number theory

  • 3,935 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added February 7, 2026
researchpythongobashdocumentation

Works with

  • cli

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add parcadei/Continuous-Claude-v3 --skill modular-arithmetic --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Modular Arithmetic?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Modular Arithmetic
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/parcadei-modular-arithmetic/badge)](https://www.skillsdirectory.com/skills/parcadei-modular-arithmetic)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…