Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.9k
GH-1005: Pell's equation#1388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
79f7120 toa4c3729CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
adamant-pwn commentedNov 4, 2024
Possibly useful:Codeforces - Pythagorean triples and Pell's equations. |
db59072 to4732ab4CompareBhaskar1312 commentedNov 17, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
added in reference section |
123711e tobd4351cCompareUh oh!
There was an error while loading.Please reload this page.
adamant-pwn left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hi, could you please add this article toREADME.md andmavigation.md into lists of new articles?
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
f88828b toc72a19cCompareBhaskar1312 commentedMar 26, 2025
added in |
mhayter commentedApr 11, 2025
Updates? |
Bhaskar1312 commentedApr 12, 2025
Updated all suggestions. Have I missed any? |
ab10315 to5ff3016Compare5ff3016 to32e048bCompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| It can also be calculated using only[integer based calculation](https://cp-algorithms.com/algebra/continued-fractions.html) | ||
| ###Finding the solution using Chakravala method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This looks complicated. Are there specific reasons to do it over continued fractions variant? I find the exposition very hard to read (largely because of misrenders, though).
Unless it's in some way better than continued fractions method, I'd consider dropping the section altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Added link to continued fractions and removed floating point based
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks! But I'm still not convinced this section is needed at all. It seems much more complicated than doing it with convergents. I really think we should either have a good reason to include it (e.g. mention why is it better than convergents), or remove it.
271c26a to3f2791eCompare22d960e to8f4864bCompare
adamant-pwn left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hi, thanks for the updates! I think we should still add some changes to it (see the review).
Uh oh!
There was an error while loading.Please reload this page.
src/others/pells_equation.md Outdated
| The norm of an expression $u + v \sqrt{d}$ is defined as $N(u + v \sqrt{d}) = (u + v \sqrt{d})(u - v \sqrt{d}) = u^2 - d v^2$. The norm is multiplicative: $N(ab) = N(a)N(b)$. This property is crucial in the descent argument below. | ||
| We will prove that all solutions to Pell's equation are given by powers of the smallest positive solution. Let's assume it to be $x_0 + y_0 \sqrt{d}$, where $x_0 > 1$ is the smallest possible value for $x$. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
| We will prove that all solutions to Pell's equation are given by powers of the smallestpositive solution. Let's assume it to be $x_0 + y_0 \sqrt{d}$, where $x_0 > 1$ is the smallest possible value for $x$. | |
| We will prove that all solutions to Pell's equation are given by powers of the smallestnon-trivial solution. Let's assume it to bethe minimum possible$x_0 + y_0 \sqrt{d} > 1$. For such a solution, it also holds that $y_0 > 0$, and its $x_0 > 1$ is the smallest possible value for $x$. |
I think we need to disambiguate between
Additionally, it would be nice to explain why the solution with smallest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is given in equations in method of descent section
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| The convergents $p_n/q_n$ are the rational approximations to $\sqrt{d}$ obtained by truncating the continued fraction expansion at each stage. These convergents can be computed recursively. For Pell's equation, the convergent $(p_n, q_n)$ at the end of the period solves $p_n^2 - d q_n^2 = \pm 1$. | ||
| Check whether the convergent satisfies Pell's equation. If it does, then the convergent is the smallest positive solution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We should also write what happens if it doesn't...
| Hence, we conclude that all solutions are given by $( x_{0} + \sqrt{d} \cdot y_{0} )^{n}$ for some integer $n$. | ||
| ##Finding the smallest positive solution | ||
| ###Expressing the solution in terms of continued fractions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should we include a proof to this? I have it onCodeforces, but it's a bit technically involved, I suppose...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Proof is already in method of descent section
| d0=1 | ||
| a0=int(math.isqrt(n)) | ||
| period= [] | ||
| m, d, a= m0, d0, a0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It would be nice to add some details on what expression you represent with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
added recurrence relations
| It can also be calculated using only[integer based calculation](https://cp-algorithms.com/algebra/continued-fractions.html) | ||
| ###Finding the solution using Chakravala method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks! But I'm still not convinced this section is needed at all. It seems much more complicated than doing it with convergents. I really think we should either have a good reason to include it (e.g. mention why is it better than convergents), or remove it.
Uh oh!
There was an error while loading.Please reload this page.
9cf13e5 toeea90beCompareeea90be to982d59eCompare
Uh oh!
There was an error while loading.Please reload this page.
Proof and how to find using continued fractions.
Chakralava Method
Problems
References