This first finds all primitive fundamental solutions, then all fundamental solutions for the diophantine equation x2 – Dy2 = N, D > 0, D not a perfect square, N ≠ 0. We have to find all primitive fundamental solutions of the equations x2 – Dy2 = N/f2 for all divisors f of N such that f2 divides N; these belong to classes P, where P2D (mod |N| ).
E = 1 is verbose and prints partial and complete quotients, as well as convergents, up to the end of a period (or double period, in the case of odd period).
Our algorithm (LMM) goes back to Lagrange 1770 and should be better known, as it generalises the well-known continued fraction algorithm for solving Pell's equation. (See a slide-talk (pdf) by Keith Matthews.)
Another approach to the algorithm, using ideals, was discovered by Richard Mollin - see Expositiones Math. 19 (2001) 55-73.
The standard method is due to Gauss - see G.B. Mathews Number Theory, page 97 or John Robertson, Computing in quadratic orders, page 14.
The book L'équation diophantienne du second degré, Alain Faisant, Hermann 1991, has an algorithm for getting all solutions, which also uses continued fractions.
Enter D (< 1020):
61
Enter N (≠ 0):
97
Enter E (0 or 1):
1
GO RESET
Last modified 7th March 2015
http://www.numbertheory.org/php/patz.html
上面的链接里面有一个pdf,详细的讲了如何求解 kastin 发表于 2019-3-19 18:18
见https://bbs.emath.ac.cn/thread-15533-1-1.html
以及http://mathworld.wolfram.com/PellEquation.html最 ...
第1个链接怎么没了? pell方程,佩尔方程,x^2-31y^2=8837,素数
试试这个 我看懂了华罗庚的解答,
他是通过不断降低N,形成一个多米诺骨牌,
然后N的绝对值<根号d,这时候方程可解,
再把解倒退回去,就得到原方程的解! 华罗庚的求解办法不好,
需要多次求解剩余方程,
然后求出来的解未必是整数解。 https://bbs.emath.ac.cn/forum.php?mod=redirect&goto=findpost&ptid=2836&pid=88108
愿力大于一切!
只要想知道如何求解,就有一天能解决!
我现在解决了这个问题 给我推荐几个在线计算pell方程的网站
以下是几个可以**在线计算佩尔方程(Pell's Equation)** \( x^2 - D y^2 = 1 \) 或广义形式 \( x^2 - D y^2 = N \) 的实用网站,涵盖从快速求解到高精度计算的需求:
---
### **1. Alpertron 佩尔方程求解器**
🔗 [https://www.alpertron.com.ar/QUAD.HTM](https://www.alpertron.com.ar/QUAD.HTM)
- **特点**:
- 支持广义佩尔方程 \( x^2 - D y^2 = N \)(可自定义 \( D \) 和 \( N \))。
- 提供**最小解**和**通解生成公式**。
- 高精度计算,适用于 \( D \) 极大(如 \( D > 10^6 \))。
- **示例**:
输入 `x² - 61 y² = 1`,输出:
\[
x = 1766319049, \ y = 226153980
\]
---
### **2. Wolfram Alpha(自然语言计算)**
🔗 [https://www.wolframalpha.com/](https://www.wolframalpha.com/)
- **特点**:
- 直接输入自然语言(如 `solve x^2 - 97y^2=1 over integers`)。
- 提供解析解、最小解和数学解释。
- **优势**:适合快速验证,附带图表和关联公式。
---
### **3. OEIS(最小解数据库)**
🔗 (https://oeis.org/A033313)(最小 \( x \))
🔗 (https://oeis.org/A033316)(最小 \( y \))
- **特点**:
- 收录 \( D \leq 1000 \) 的佩尔方程最小解。
- 示例:查询 \( D=61 \) 得 \( x = 1766319049, y = 226153980 \)。
- **用途**:快速查找小 \( D \) 的解。
---
### **4. SageMathCell(编程求解)**
🔗 [https://sagecell.sagemath.org/](https://sagecell.sagemath.org/)
- **特点**:
- 支持自定义代码求解,适合复杂需求。
- **示例代码**:
```python
from sympy.solvers.diophantine import diop_DN
D = 97# 修改D值
x, y = diop_DN(D, 1)
print(f"最小解: x = {x}, y = {y}")
```
- 输出:`x = 62809633, y = 6377352`。
---
### **5. Number Theory Web(基础工具)**
🔗 [http://www.numbertheory.org/php/pell.html](http://www.numbertheory.org/php/pell.html)
- **特点**:
- 输入 \( D \),返回最小解和连分数展开步骤。
- 仅支持标准佩尔方程(\( N=1 \)),界面较旧但稳定。
---
### **6. Dario Alpern 的连分数工具**
🔗 [https://www.alpertron.com.ar/CONTFRAC.HTM](https://www.alpertron.com.ar/CONTFRAC.HTM)
- **特点**:
- 计算 \( \sqrt{D} \) 的连分数展开,间接生成佩尔方程的解。
- 适合研究解与连分数周期的关系。
---
### **7. GitHub 开源工具(本地计算)**
🔗 (https://github.com/topics/pell-equation)
- **特点**:
- 下载开源代码(如基于PARI/GP或SymPy的工具),离线求解大数问题。
- 适合需要批量计算的研究者。
---
### **选择建议**
| **需求** | **推荐工具** |
|-------------------------|---------------------------------------|
| 快速求解小 \( D \) | Wolfram Alpha 或 OEIS |
| 广义方程 \( x^2 - D y^2 = N \) | Alpertron |
| 研究连分数与解的关系 | Alpertron 连分数工具 |
| 编程或自定义计算 | SageMathCell 或 GitHub 开源代码 |
---
### **验证解的正确性**
若得到解 \( (x, y) \),可通过简单计算验证:
```python
D = 61
x, y = 1766319049, 226153980
print(x**2 - D * y**2)# 输出应为 1
```
这些工具基本覆盖了从初学者到专业研究者的需求,根据实际场景选择即可! 上面的是markdown语法,
要是能直接转换成论坛格式就好了!
不高,虽然不转化,主要内容都清楚的显示出来了 以下是整理好的在线计算佩尔方程的网站推荐,每个介绍后均附上独立网址,方便直接复制分享:
1. Alpertron 佩尔方程求解器
支持广义佩尔方程x^2 - D y^2 = N ,提供最小解和通解公式,适用于极大D值。
🔗 https://www.alpertron.com.ar/QUAD.HTM
2. Wolfram Alpha
自然语言输入(如 solve x² - 97y²=1 over integers ),提供解析解、图表和数学解释。
🔗 https://www.wolframalpha.com/
3. OEIS 最小解数据库
收录D \leq 1000的最小解,直接查询数值结果。
- 最小x :https://oeis.org/A033313
- 最小y :https://oeis.org/A033316
4. SageMathCell
支持自定义编程求解(如 Python/SymPy),适合复杂需求。
🔗 https://sagecell.sagemath.org/
5. Number Theory Web
基础工具,返回最小解和连分数展开步骤,仅支持标准佩尔方程( N=1 )。
🔗 http://www.numbertheory.org/php/pell.html
6. Dario Alpern 连分数工具
通过计算\sqrt{D}的连分数展开间接生成解,适合研究解与连分数周期的关系。
🔗 https://www.alpertron.com.ar/CONTFRAC.HTM
7. OFFTONIC PELL SOLVER
高精度求解x^2 - D y^2 = N ,支持D和N的绝对值小于2^{31} 。
🔗 https://offtonic.com/pell/
8. MathCelebrity
输入D和N直接计算,提供分步解释和验证公式。
🔗 https://www.mathcelebrity.com/pell.php
9. Symbolab
分步解答佩尔方程,支持广义形式x^2 - D y^2 = N ,界面简洁直观。
🔗 https://www.symbolab.com/solver/pell-equation-calculator
10. A-Calculator
轻量级嵌入式计算器,快速求解标准佩尔方程x^2 - D y^2 = 1 。
🔗 https://www.a-calculator.com/pell-equation/embed.html
11. Oocities 基础求解器
简单输入n求解x^2 - n y^2 = 1 ,适合学习基础用法(界面较旧)。
🔗 https://www.oocities.org/gaurav1146/pell.html
12. Microsoft Math Solver
功能全面的数学工具,支持佩尔方程求解并提供分步视频讲解。
🔗 https://mathsolver.microsoft.com/zh
验证解的代码片段
若需验证解的正确性,可使用以下 Python 代码:
D = 61# 修改D值
x, y = 1766319049, 226153980# 替换为实际解
print(x**2 - D * y**2)# 输出应为 1
根据需求选择即可,建议优先使用 Alpertron 或 Symbolab 处理复杂方程,OEIS 或 A-Calculator 适合快速查询小D的解。
页:
1
[2]