MCP HubMCP Hub
SKILL·D8B5C9

explore-diophantine-equations

pjt222
Actualizado 1 month ago
8 vistas
24
3
24
Ver en GitHub
Otrogeneral

Acerca de

Esta habilidad ayuda a los desarrolladores a resolver ecuaciones diofánticas (soluciones enteras), incluyendo ecuaciones lineales, ecuaciones de Pell y ternas pitagóricas. Determina la solubilidad, encuentra soluciones mínimas y proporciona formas paramétricas. Úsala para problemas de teoría de números, diseño de algoritmos o cuando trabajes con restricciones enteras en programación matemática.

Instalación rápida

Claude Code

Recomendado
Principal
npx skills add pjt222/agent-almanac -a claude-code
Comando PluginAlternativo
/plugin add https://github.com/pjt222/agent-almanac
Git CloneAlternativo
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/explore-diophantine-equations

Copia y pega este comando en Claude Code para instalar esta habilidad

Documentación


name: explore-diophantine-equations description: > 探索丢番图方程:线性丢番图方程(扩展 Euclid 算法)、Pell 方程 (连分数法)、勾股方程(参数化解)和高次方程(Fermat 大定理及 相关结果)。涵盖可解性判定、解的参数化和求最小正整数解。 license: MIT allowed-tools: Read Grep Glob WebFetch WebSearch metadata: author: Philipp Thoss version: "1.0" domain: number-theory complexity: intermediate language: natural tags: number-theory, diophantine-equations, pell-equation, pythagorean-triples, fermat locale: zh-CN source_locale: en source_commit: 6f65f316 translator: claude-sonnet-4-6 translation_date: 2026-03-16

探索丢番图方程

系统求解要求整数解的丢番图方程,涵盖线性方程、Pell 方程、勾股方程和高次方程。

适用场景

  • 求解线性丢番图方程 ax + by = c 的整数解
  • 使用连分数法求解 Pell 方程 x^2 - Dy^2 = 1
  • 生成和分析勾股数组 (a, b, c) 满足 a^2 + b^2 = c^2
  • 分析高次丢番图方程的可解性
  • 将实际问题转化为丢番图方程

输入

  • 必需:丢番图方程的陈述
  • 可选:解的约束(正整数、非负整数、某范围内)
  • 可选:是否需要所有解的参数化或仅特定解
  • 可选:应用上下文

步骤

第 1 步:分类方程并判定可解性

确定方程类型和解的存在性:

  1. 线性丢番图方程 ax + by = c:
    • 有解当且仅当 gcd(a, b) | c
    • 如果有解,则有无穷多解
  2. Pell 方程 x^2 - Dy^2 = 1(D 为非完全平方正整数):
    • 总是有非平凡解
    • 最小正解可通过 sqrt(D) 的连分数展开求得
  3. 负 Pell 方程 x^2 - Dy^2 = -1:
    • 不一定有解——取决于 D 的性质
    • 有解当且仅当 sqrt(D) 的连分数周期长度为奇数
  4. 勾股方程 x^2 + y^2 = z^2:
    • 所有本原解(gcd(x,y,z) = 1)由参数化给出
  5. Fermat 方程 x^n + y^n = z^n(n ≥ 3):
    • 无正整数解(Fermat 大定理,Wiles 1995 年证明)
  6. 一般二次丢番图方程:可使用 Hasse-Minkowski 定理等工具分析。

预期结果: 方程已分类,可解性条件已确定或证明无解。

失败处理: 如果方程不属于标准类型,尝试通过变量替换或模运算论证将其转化为已知类型。模运算是证明无解的强大工具。

第 2 步:求解方程

根据方程类型求解:

  1. 线性丢番图方程
    • 使用扩展 Euclid 算法找 ax + by = gcd(a,b) 的特解 (x_0, y_0)
    • 缩放得到 ax + by = c 的特解:x_0' = x_0 * c/gcd(a,b)
    • 通解:x = x_0' + (b/d)t, y = y_0' - (a/d)t,t 为任意整数
    • 对于正整数解,求 t 的范围使 x > 0 且 y > 0
  2. Pell 方程
    • 计算 sqrt(D) 的连分数展开 [a_0; a_1, a_2, ..., a_k, ...]
    • 找到周期长度 k
    • 如果 k 为偶数,第 k-1 个渐近分数 p_(k-1)/q_(k-1) 给出最小解
    • 如果 k 为奇数,第 2k-1 个渐近分数给出最小解
    • 所有解由递推生成:(x_(n+1), y_(n+1)) = (x_1 * x_n + D * y_1 * y_n, x_1 * y_n + y_1 * x_n)
  3. 勾股数组
    • 本原勾股数组参数化:对互素的 m > n > 0(一奇一偶)
    • a = m^2 - n^2, b = 2mn, c = m^2 + n^2
    • 一般勾股数组为本原数组的倍数

预期结果: 方程的特解和通解(或参数化),正整数解的范围(如有约束)。

失败处理: 如果连分数计算错误,通过代入 x^2 - Dy^2 验证候选解。连分数的每一步都应验证。

第 3 步:验证和分析解

确认解的正确性并进行进一步分析:

  1. 代入验证:将求得的解代入原方程确认等式成立。
  2. 完整性检查
    • 对于线性方程,验证通解公式生成的解确实覆盖所有解
    • 对于 Pell 方程,验证递推关系正确生成后续解
  3. 最小解:确认找到的是最小正解(对 Pell 方程尤其重要)。
  4. 解的性质分析
    • 解的增长率(Pell 方程的解呈指数增长)
    • 解的模式和规律
  5. 应用解释:将数学解翻译回原始问题的语境。

预期结果: 所有解经验证正确,解的结构(通解公式或参数化)已完整描述。

失败处理: 如果验证失败,重新检查计算步骤。对于 Pell 方程,确认 D 不是完全平方数(完全平方数的 Pell 方程无正整数解)。

验证清单

  • 方程类型正确分类
  • 可解性条件已验证
  • 所有解代入原方程验证正确
  • 通解公式覆盖所有解
  • 正整数解的范围正确计算(如有约束)
  • Pell 方程的最小正解正确
  • 勾股数组的本原性条件已检查

常见问题

  • 混淆 Pell 方程的两种形式:x^2 - Dy^2 = 1 和 x^2 - Dy^2 = -1 是不同的方程,后者不一定有解。
  • D 为完全平方数:当 D = k^2 时,x^2 - k^2*y^2 = (x-ky)(x+ky) = 1 只有平凡解 y = 0, x = ±1。
  • 忽略线性方程的可解性条件:ax + by = c 仅在 gcd(a,b) | c 时有解。直接使用扩展 Euclid 算法而不检查此条件可能得到非整数"解"。
  • 勾股数组参数化的条件:m 和 n 必须互素且一奇一偶,否则生成的不是本原数组。
  • 模运算论证的方向:模运算可以证明无解(如果模某个数无解,则整体无解),但不能直接证明有解。

相关技能

  • analyze-prime-numbers -- 丢番图方程的可解性常依赖于素数性质
  • solve-modular-arithmetic -- 模运算是分析丢番图方程的基本工具
  • derive-theoretical-result -- 某些丢番图方程需要理论推导来完全解决

Repositorio GitHub

pjt222/agent-almanac
Ruta: i18n/zh-CN/skills/explore-diophantine-equations
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams
FAQ

Frequently asked questions

What is the explore-diophantine-equations skill?

explore-diophantine-equations is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform explore-diophantine-equations-related tasks without extra prompting.

How do I install explore-diophantine-equations?

Use the install commands on this page: add explore-diophantine-equations to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.

What category does explore-diophantine-equations belong to?

explore-diophantine-equations is in the Other category, tagged general.

Is explore-diophantine-equations free to use?

Yes. explore-diophantine-equations is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.

Habilidades relacionadas

llamaguard
Otro

LlamaGuard es el modelo de Meta de 7-8B parámetros para moderar las entradas y salidas de LLM en seis categorías de seguridad como violencia y discurso de odio. Ofrece una precisión del 94-95% y puede implementarse usando vLLM, Hugging Face o Amazon SageMaker. Utiliza esta skill para integrar fácilmente filtrado de contenido y barreras de seguridad en tus aplicaciones de IA.

Ver habilidad
cost-optimization
Otro

Esta Skill de Claude ayuda a los desarrolladores a optimizar los costes en la nube mediante el ajuste de tamaño de recursos, estrategias de etiquetado y análisis de gastos. Proporciona un marco para reducir los gastos en la nube e implementar una gobernanza de costes en AWS, Azure y GCP. Úsala cuando necesites analizar los costes de infraestructura, ajustar el tamaño de los recursos o cumplir con restricciones presupuestarias.

Ver habilidad
sports-betting-analyzer
Otro

Esta habilidad de Claude analiza los mercados de apuestas deportivas, incluyendo spreads, over/unders y apuestas de propuestas, mediante el examen de tendencias históricas y estadísticas situacionales para identificar apuestas de valor. Proporciona una salida en markdown estructurado con recomendaciones accionables con fines educativos. Los desarrolladores deben utilizar esto para herramientas de análisis de apuestas deportivas, teniendo en cuenta que está diseñado únicamente para entretenimiento/educación.

Ver habilidad
quantizing-models-bitsandbytes
Otro

Esta habilidad cuantiza LLMs a precisión de 8 o 4 bits utilizando bitsandbytes, logrando una reducción de memoria del 50-75% con pérdida mínima de precisión. Es ideal para ejecutar modelos más grandes en memoria GPU limitada o para acelerar la inferencia, admitiendo formatos como INT8, NF4 y FP4. La habilidad se integra con HuggingFace Transformers y permite entrenamiento QLoRA y optimizadores de 8 bits.

Ver habilidad