Skip to content

Commit d046c9e

Browse files
committed
references and problem from project euler
1 parent 66f572a commit d046c9e

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/others/pells_equation.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,31 @@ $$\sf=2+\cfrac{1}{1+\cfrac1{1+\cfrac1{1+\cfrac4{\vdots}}}}$$
7676
we get the continued fraction of $\sf$ as $[2; 1, 1, 4, 1, 1, 4, \ldots]$.
7777

7878
### Finding the solution using Chakravala method
79+
The Chakravala method is an ancient Indian algorithm to solve Pell's equation. It is based on the Brahmagupta's identity of quadratic decomposition.
80+
$(x_{1}^{2} - n \cdot y_{1}^{2}) \cdot (x_{2}^{2} - n \cdot y_{2}^{2}) = (x_{1} \cdot x_{2} + n \cdot y_{1} \cdot y_{2})^{2} - n \cdot (x_{1} \cdot y_{2} + x_{2} \cdot y_{1})^{2}$
81+
$(x_{1}^{2} - n \cdot y_{1}^{2}) \cdot (x_{2}^{2} - n \cdot y_{2}^{2}) = (x_{1} \cdot x_{2} - n \cdot y_{1} \cdot y_{2})^{2} - n \cdot (x_{1} \cdot y_{2} - x_{2} \cdot y_{1})^{2}$
7982

83+
Using above Brahmagupta's identity, If $(x_{1}, y_{1}, k_{1})$ and $(x_{2}, y_{2}, k_{2})$ satisfy $(x_{1}^{2} - y_1^{2}) \cdot (x_{2}^{2} - y_2^{2}) = k_{1} \cdot k_{2} $, then $(x_{1} \cdot x_{2} + n \cdot y_{1} \cdot y_{2}, x_{1} \cdot y_{2} + y_{1} \cdot x_{2}, k_{1} \cdot k_{2})$ is also a solution of $(x_{1} \cdot x_{2} + n \cdot y_{1} \cdot y_{2})^{2} - n \cdot (x_{1} \cdot y_{2} + x_{2} \cdot y_{1})^{2} = k_{1} \cdot k_{2}$
84+
85+
[//]: # (First, we choose $y_{1} = 1$ and choose $x_{1} = \lfloor \sqrt n \rfloor$ such that $k_{1}$ is a small integer.)
86+
87+
[//]: # ()
88+
[//]: # (Then, Iteratively we adjust $x_{1}$ and $y_{1}$ so that $k_{1} = 1$. The solution is given by $(x_{1}, y_{1})$ to original Pell's equation.)
89+
[//]: # ()
90+
[//]: # ( Choosing m. At e)
8091

8192
## Implementation
8293
```cpp
8394

84-
```
95+
```
96+
97+
## References
98+
- [Pell's equation - Wikipedia](https://en.wikipedia.org/wiki/Pell%27s_equation)
99+
- [Periodic Continued Fractions](https://en.wikipedia.org/wiki/Periodic_continued_fraction)
100+
- [Chakralava Method - Wikipedia](https://en.wikipedia.org/wiki/Chakravala_method)
101+
- [Chakralava Method](https://www.isibang.ac.in/~sury/chakravala.pdf)
102+
- [Codeforces Pell's Equation](https://codeforces.com/topic/116937/en20)
103+
104+
## Problems
105+
- [Project Euler 66](https://projecteuler.net/problem=66)
106+
- [Hackerrank ProjectEuler-066](https://www.hackerrank.com/contests/projecteuler/challenges/euler066/problem)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy