Skip to main content
skill CX Codex

prime-numbers — Claude Code skill: primality and factorization algorithms

Skill for working with prime numbers in graph and number theory. Offers strategies for primality testing (trial division, Miller-Rabin, AKS), factorization, and applications of Fermat's and Wilson's theorems through Bash and Read tools.

MIT 1 installs ★ 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 prime-numbers -a claude-code
Open on GitHub

What prime-numbers does

Built around an algorithm hierarchy: trial division at O(√n), probabilistic Miller-Rabin, deterministic AKS. For factorization, trial division handles small factors, Pollard's rho works on medium numbers, and quadratic sieve tackles large ones via sympy_compute.py and z3_solve.py commands.

The skill includes tools for primality verification without checking divisors, computing prime distribution through the Prime Number Theorem, and applying Fermat's and Wilson's theorems. Commands like uv run python -m runtime.harness scripts/sympy_compute.py factor "n" run through Bash.

Requires Bash access and file reading capability. Algorithm choice depends on number size and assurance level: trial division is exact but slow, Miller-Rabin is fast but probabilistic, AKS is polynomial and reliable.

What it helps with

  • determine if a number is prime
  • factor a number into prime components
  • analyze prime distribution and gaps between consecutive primes
  • verify number properties using Fermat's and Wilson's theorems
  • select the right algorithm by complexity and problem type

Example prompts for the agent

  • Test if 2147483647 is prime using Miller-Rabin
  • Factor 12345 with sympy_compute.py factor
  • Prove that 17 satisfies Fermat's Little Theorem via z3_solve.py

How to install prime-numbers

1Skills CLI (Vercel)

npx skills add parcadei/Continuous-Claude-v3 --skill prime-numbers -a claude-code

2Manually: put the files in place

~/.claude/skills/prime-numbers/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/prime-numbers/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about prime-numbers

How do I install prime-numbers in Claude Code?

Run npx skills add parcadei/Continuous-Claude-v3 --skill prime-numbers -a claude-code, then check the file ~/.claude/skills/prime-numbers/SKILL.md.

What does the prime-numbers skill do?

It provides algorithms for primality testing (trial division, Miller-Rabin, AKS), factorization, and implementations of Fermat's and Wilson's theorems for number and graph theory work.

Which algorithm should I use to test if a large number is prime?

For medium-sized numbers, use Miller-Rabin (O(k log³ n)), which is fast and probabilistic. For larger numbers, AKS is deterministic at O(log⁶ n). Trial division (O(√n)) only works for small numbers.

Source text

SKILL.md · MIT
---
name: prime-numbers
description: "Problem-solving strategies for prime numbers in graph number theory"
allowed-tools: [Bash, Read]
---

# Prime Numbers

## When to Use

Use this skill when working on prime-numbers problems in graph number theory.

## Decision Tree


1. **Primality testing hierarchy**
   - Trial division: O(sqrt(n)), exact
   - Miller-Rabin: O(k log^3 n), probabilistic
   - AKS: O(log^6 n), deterministic polynomial

2. **Factorization**
   - Trial division for small factors
   - Pollard's rho: probabilistic, medium numbers
   - Quadratic sieve: large numbers
   - `sympy_compute.py factor "n"`

3. **Prime distribution**
   - Prime Number Theorem: pi(x) ~ x/ln(x)
   - Prime gaps: p_{n+1} - p_n
   - `sympy_compute.py limit "pi(x) * ln(x) / x"`

4. **Fermat's Little Theorem**
   - a^{p-1} = 1 (mod p) for a not divisible by p
   - Use for modular exponentiation
   - `z3_solve.py prove "fermat_little"`

5. **Wilson's Theorem**
   - (p-1)! = -1 (mod p) iff p is prime


## Tool Commands

### Sympy_Factor
```bash
uv run python -m runtime.harness scripts/sympy_compute.py factor "n"
```

### Z3_Primality
```bash
uv run python -m runtime.harness scripts/z3_solve.py prove "no_divisor_between_1_and_sqrt_n"
```

### Sympy_Prime_Count
```bash
uv run python -m runtime.harness scripts/sympy_compute.py simplify "pi(x) ~ x/ln(x)"
```

### Z3_Fermat_Little
```bash
uv run python -m runtime.harness scripts/z3_solve.py prove "a**(p-1) == 1 mod p"
```

## Key Techniques

*From indexed textbooks:*


## 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 →
system-overview system-overview displays the Continuous Claude architecture, showing memory layers, 9 registered hook types, and session continuity mechanisms. CX Codex +1 474installs proof-theory proof-theory — a skill for mathematical logic proofs and decision trees across strategies. Guides you through direct proof, proof by contradiction, case analysis, and induction; verifies soundness, completeness, and cut elimination. CX Codex +1 1installs propositional-logic Guides solving propositional logic problems using truth tables, Z3 proofs, and semantic tableaux. CX Codex +1 1installs predicate-logic A skill for tackling predicate logic in mathematical logic. Handles quantifier analysis, normal form conversion, proof construction, and countermodel search. CX Codex +1 1installs matrices matrices — a skill for matrix operations: identifies types, performs arithmetic, solves linear systems. Includes decompositions like LU, QR, SVD and works across Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode. CX Codex +1 1installs leann-search leann-search runs semantic code queries against a LEANN vector index when exact keyword matches fall short. CX Codex +1 ★ 3,951repo stars natural-transformations This skill guides category-theory work on natural transformations, with Lean 4 notation for checking naturality and applying related constructions. CX Codex +1 ★ 3,951repo stars categories-functors categories-functors — a skill for solving category and functor problems in category theory. Validates axioms, checks functor properties, and verifies proofs in Lean 4 via compiler. CX Codex +1 ★ 3,951repo stars

Project sponsors

Companies that keep this analytics open