---
name: prime-numbers-ba60f60cf26b
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.


---
Source attribution: vibeeval
Original project: https://github.com/vibeeval/vibecosystem/blob/3b763b1fb288f57bfa3cce76ef18184b96461a78/skills/math/graph-number-theory/prime-numbers/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 vibeeval

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: vibeeval
Original project: https://github.com/vibeeval/vibecosystem/blob/3b763b1fb288f57bfa3cce76ef18184b96461a78/skills/math/graph-number-theory/prime-numbers/SKILL.md
Attribution basis: Source repository record

Fields of work: Data & Analytics, Development & Engineering, Education & Research
Roles: Data Scientist, ML / AI Engineer, Researcher
Specialties: API
Tools: Sympy, Z3
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 32f1c5946369f4ef69965ebdd54fbc48d9a29a89b6b96840f0930db89223a822
