number-theory
Skill0 starsChanged 4 months agoMITView on GitHub
Turns Claude into a rigorous number-theory problem-solving assistant rather than a theorem dump. Use for divisibility, gcd, lcm, congruences, modular arithmetic, primes, factorization, Diophantine and Pell equations, arithmetic functions, Euler totient, quadratic residues, Legendre and Jacobi symbols, quadratic reciprocity, multiplicative order, primitive roots, p-adic valuations, LTE, integer sequences, olympiad number theory, infinite descent, Vieta jumping, CRT, Fermat's Little Theorem, Euler's theorem, and Wilson's theorem. Formalize variables, domains, quantifiers, and the exact claim; classify; explore with bundled scripts; then prove. Treat computation as evidence, never as a proof, unless the user asked for a computational result. Use this skill when the user pastes a contest problem or says show that / find all integers, even if they never name number theory.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ffsshhttiikk/opencode-agents-skillstheir own version, first seen Feb 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- ffsshhttiikk/opencode-agents-skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
If the user asked only for a numerical value (a gcd, an inverse, residues) and not a proof, run scripts/nt.py and report the result.
- Distinctive: line 54
If classification is unclear, start at references/catalog.md.
- Distinctive: line 58
When useful — and always before a “for all n” claim — try small cases, factor expressions, inspect residues modulo small integers or …
- Distinctive: line 79
Treat CLI output as experimental evidence.
- Distinctive: line 92
No division by an expression that can vanish.
- Distinctive: line 106
If the attack succeeds, repair the proof or retract the claim.
- Distinctive: line 122
Keep Exploration brief (what you computed and what it suggested).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Number theory
Settle claims with definitions, lemmas, and proofs. Theorems are tools, not the product. Computation finds structure; it does not replace deduction.
If the user asked only for a numerical value (a gcd, an inverse, residues) and not a proof, run scripts/nt.py and report the result. Skip the pipeline.
Pipeline
For every nontrivial problem, follow this order. Do not jump to a named theorem because the wording looks familiar.
1. Formalize
Identify variables, domains, quantifiers, standing assumptions, and the exact claim. Rewrite the problem as a precise statement. If the domain is ambiguous (does ℕ include 0?), say which convention you adopt.
2. Classify
Assign one or more categories, then read only the matching files:
| Category | Read |
| gcd / divisibility / Euclidean algorithm / Bézout | references/gcd-divisibility.md |
| congruences / inverses / Fermat / Euler / Wilson / CRT | references/modular-arithmetic.md |
| primes / unique factorization | references/primes-factorization.md |
| linear / Pell / Pythagorean / other Diophantine equations | references/diophantine.md |
| quadratic residues / Legendre / Jacobi / reciprocity | references/quadratic-residues.md |
| multiplicative order / primitive roots | references/multiplicative-order.md |
| p-adic valuation / LTE | references/valuations.md |
| φ, μ, σ, d / Möbius inversion | references/arithmetic-functions.md |
| recurrences / Fibonacci / periodic sequences mod m | references/integer-sequences.md |
| descent / Vieta jumping / invariants / pigeonhole / factorization identities | references/olympiad-techniques.md |
If classification is unclear, start at references/catalog.md. Before any proof that cancels, inverts, assumes coprimality, or cites primality, read references/common-traps.md.
3. Explore (before proving)
When useful — and always before a “for all n” claim — try small cases, factor expressions, inspect residues modulo small integers or primes, look for invariants, and actively search for counterexamples.
CLI (skill root is ${CLAUDE_SKILL_DIR}):
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py factor 123456789
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py gcd 252 105
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py egcd 240 46
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py crt 2 3 3 5 2 7
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py order 2 101
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py phi 60
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py valuation 1728 2
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py residues 17
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py legendre 5 17
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py seq fibonacci 20
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py holds 1 1000 'not is_square(n*n + n + 1)'
python3 ${CLAUDE_SKILL_DIR}/scripts/nt.py find 0 50 'not is_prime(n*n + n + 41)'Full command list: references/cli.md.
Treat CLI output as experimental evidence. It may suggest a lemma, a bound, or a counterexample. It is not a proof unless the user asked only for a computational result, or the search domain is finite and you exhausted it with a stated bound.
The CLI refuses silent assumptions (order when gcd(a,m)≠1, Legendre at a composite, and so on). Match that discipline in the writeup.
4. Prove
Lead with the key observation — the structural fact that makes the rest routine. Then write a complete argument:
- Cancellation in a congruence cites
gcd(c,m)=1or replaces the modulus bym/gcd(c,m). - Inverses, orders, and Euler’s theorem check coprimality.
- “p is prime” is given or proved, never guessed from a formula.
- 0, 1, negatives, and the primes 2 and 3 are handled when the identity is sensitive to them.
- Implications are not reversed; necessary and sufficient conditions are labeled.
- No division by an expression that can vanish.
Load theorem details from the classified reference files, not from memory of a similar contest problem.
5. Adversarial verification
Attack the argument before presenting it:
- Counterexample to a lemma used more strongly than stated?
- Jacobi treated as Legendre? Fermat used for composite n?
φ(mn)=φ(m)φ(n)withoutgcd(m,n)=1? - Division by zero hidden in an algebraic identity?
- Finite check of small n sold as a universal proof?
- Wrong standard theorem because the hypotheses do not match?
If the attack succeeds, repair the proof or retract the claim. Only then give the final answer.
Gold-standard writeups: examples/response-format.md, examples/invalid-proof.md, examples/wrong-theorem.md, examples/counterexample.md.
Response format
## Formalization
## Classification
## Exploration
## Key observation
## Proof
## Verification
## AnswerKeep Exploration brief (what you computed and what it suggested). The Proof must stand without it. Verification is an explicit attack, not the sentence “the proof is correct.”
Composition
This skill owns number-theoretic claims. If a sibling proof-verifier skill is installed, run it during Verification. If the problem is primarily combinatorics or abstract algebra, defer to those skills and use this one only for number-theoretic subclaims. Future domain skills belong next to this folder as skills/<name>/; do not fold them into these references.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

