计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
explore-diophantine-equations【效率与协作】Solve Diophantine equations (integer-only solutions) including linear, quadratic, and Pell equations. Covers the extended Euclidean algorithm, descent methods, and existence proofs. Use when finding all integer solutions to ax + by = c, solving Pell's equation, generating Pythagorean triples, proving no integer solutions exist via modular constraints…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Solve Diophantine equations — polynomial w/ integer-only solutions. Classify by type, test solvability, find particular + general, generate families. Linear, Pell, Pythagorean, general quadratic.
Determine structure → select method.
Linear: ax + by = c (a, b, c integers, x, y unknown).
Pell: x^2 - Dy^2 = 1 (or -1, or N) (D positive non-square).
Pythagorean: x^2 + y^2 = z^2.
General quadratic: ax^2 + bxy + cy^2 + dx + ey + f = 0.
Higher-order/special: Fermat-type (x^n + y^n = z^n, n > 2), sum of squares, other.
Record classification + method.
→ Precise classification + strategy.
If err: no standard type → try substitution/transformation to known form. x^2 + y^2 + z^2 = n via Legendre's 3-square. No reduction → modular (Step 4).
Solve ax + by = c for integer x, y.
Compute g = gcd(a, b) via Euclidean.
Test: Solutions iff g | c.
Simplify: Divide by g → (a/g)x + (b/g)y = c/g, gcd(a/g, b/g) = 1.
Particular via extended Euclidean:
General:
Apply constraints (positive solutions):
Example (15x + 21y = 39):
gcd(15, 21) = 3. Does 3 | 39? Yes.
Simplify: 5x + 7y = 13.
Extended Euclidean: 1 = 3*5 - 2*7.
Multiply by 13: 13 = 39*5 - 26*7.
Particular: x0 = 39, y0 = -26.
General: x = 39 + 7k, y = -26 - 5k, k in Z.
Check (k=0): 5*39 + 7*(-26) = 195 - 182 = 13. Correct.
→ General family (x, y) parameterized by k + verified particular.
If err: particular wrong → re-check extended Euclidean back-sub step-by-step. Common: sign mistake. Verify: a * x0 + b * y0 = c exactly (not modulo).
Solve x^2 - Dy^2 = 1 (D positive non-square).
Verify D non-square: D = k^2 → x^2 - k^2*y^2 = (x - ky)(x + ky) = 1 → x - ky = x + ky = ±1 → y = 0, x = ±1 (trivial). Only interesting non-square D.
Continued fraction sqrt(D):
Fundamental from convergents:
Further solutions from (x1, y1):
Present fundamental + recurrence.
Fundamentals small D:
| D | (x1, y1) | D | (x1, y1) | D | (x1, y1) |
|---|---|---|---|---|---|
| 2 | (3, 2) | 7 | (8, 3) | 13 | (649, 180) |
| 3 | (2, 1) | 8 | (3, 1) | 14 | (15, 4) |
| 5 | (9, 4) | 10 | (19, 6) | 15 | (4, 1) |
| 6 | (5, 2) | 11 | (10, 3) | 17 | (33, 8) |
→ Fundamental (x1, y1) verified by substitution + recurrence.
If err: continued fraction no converge to period → check iteration. Period r can be large (D = 61 → r = 11, fundamental (1766319049, 226153980)). Large D → computational tools not manual.
Prove no integer solutions via modular obstruction.
Choose modulus m (typ 2, 3, 4, 5, 7, 8, 16).
Enumerate residues: Compute LHS mod m for all possible var residues.
Check combination gives RHS mod m.
Common obstructions:
No obstruction found → modular can't prove non-existence. Solutions may or may not → constructive or descent.
Quadratic residues ref:
| Mod | Squares (residues) |
|---|---|
| 3 | {0, 1} |
| 4 | {0, 1} |
| 5 | {0, 1, 4} |
| 7 | {0, 1, 2, 4} |
| 8 | {0, 1, 4} |
| 11 | {0, 1, 3, 4, 5, 9} |
| 13 | {0, 1, 3, 4, 9, 10, 12} |
| 16 | {0, 1, 4, 9} |
→ Proof non-existence or statement no obstruction at tested moduli.
If err: modular inconclusive → infinite descent: assume solution, derive strictly smaller, repeat → contradict positivity. Classic for x^4 + y^4 = z^2 no non-trivial.
Express all solutions via fundamental + integer params.
Linear: x = x0 + (b/g)*k, y = y0 - (a/g)*k (Step 2).
Pell: Recurrence Step 3 → first several:
(x1, y1), (x2, y2), (x3, y3), ...
List ≥3-5 as sanity check.
Pythagorean: Primitive triples from m > n > 0, gcd(m, n) = 1, m - n odd:
General: Parametric if possible. Curve genus 0 → rational parametrization. Genus ≥1 → may be finitely many (Faltings for genus ≥ 2).
Verify ≥3 family members by substitution.
Example (Pell, D = 2):
Fundamental: (x1, y1) = (3, 2). Check: 9 - 2*4 = 1. Correct.
(x2, y2) = (3*3 + 2*2*2, 3*2 + 2*3) = (17, 12). Check: 289 - 2*144 = 1.
(x3, y3) = (3*17 + 2*2*12, 3*12 + 2*17) = (99, 70). Check: 9801 - 2*4900 = 1.
→ Parametric/recursive all solutions + ≥3 verified.
If err: generated fail verification → fundamental or recurrence wrong. Pell → re-derive fundamental from continued fraction. Linear → re-check extended Euclidean.
analyze-prime-numbers — Factorization + gcd prereqssolve-modular-arithmetic — Linear congruences ax = c (mod b) equiv to linear Diophantinederive-theoretical-result — Formal derivation for Diophantine impossibility