# Can anyone help me solve this Pell equation?

I am trying to find the five smallest pairs of positive integers $$p,q$$ that satisfy the Pell's equation $$p^2-321q^2 = 1$$.

One obvious trivial solution is $$p=1$$ and $$q=0$$ , but this does not count. I am trying to find the five smallest pairs of positive integers $$p,q$$ that satisfy this equation. I would appreciate your help .

• The fundamental solution is $(215/12)$. To find it, look at the convergents corresponding to the simple continued fraction of $\sqrt{321}$ Jan 3, 2020 at 20:21

Method suitable for hand calculations.

As in the other answer, the larger solutions come from powers of the matrix $$A = \left( \begin{array}{cc} 215 & 3852 \\ 12 & 215 \\ \end{array} \right)$$ The entries in $$A^2, A^3, A^4, A^5$$ become quite large; still, the main diagonals have two equal numbers, and the determinants remain $$1.$$

The letter $$A$$ stands for Automorphism, this matrix (notice that the determinant is $$1\;$$) is the generator of the (oriented) automorphism group of the quadratic form $$x^2 - 321 y^2.$$

Method described by Prof. Lubin at Continued fraction of $\sqrt{67} - 4$

$$\sqrt { 321} = 17 + \frac{ \sqrt {321} - 17 }{ 1 }$$ $$\frac{ 1 }{ \sqrt {321} - 17 } = \frac{ \sqrt {321} + 17 }{32 } = 1 + \frac{ \sqrt {321} - 15 }{32 }$$ $$\frac{ 32 }{ \sqrt {321} - 15 } = \frac{ \sqrt {321} + 15 }{3 } = 10 + \frac{ \sqrt {321} - 15 }{3 }$$ $$\frac{ 3 }{ \sqrt {321} - 15 } = \frac{ \sqrt {321} + 15 }{32 } = 1 + \frac{ \sqrt {321} - 17 }{32 }$$ $$\frac{ 32 }{ \sqrt {321} - 17 } = \frac{ \sqrt {321} + 17 }{1 } = 34 + \frac{ \sqrt {321} - 17 }{1 }$$

Simple continued fraction tableau:
$$\begin{array}{cccccccccccccc} & & 17 & & 1 & & 10 & & 1 & & 34 & \\ \\ \frac{ 0 }{ 1 } & \frac{ 1 }{ 0 } & & \frac{ 17 }{ 1 } & & \frac{ 18 }{ 1 } & & \frac{ 197 }{ 11 } & & \frac{ 215 }{ 12 } \\ \\ & 1 & & -32 & & 3 & & -32 & & 1 \end{array}$$

$$\begin{array}{cccc} \frac{ 1 }{ 0 } & 1^2 - 321 \cdot 0^2 = 1 & \mbox{digit} & 17 \\ \frac{ 17 }{ 1 } & 17^2 - 321 \cdot 1^2 = -32 & \mbox{digit} & 1 \\ \frac{ 18 }{ 1 } & 18^2 - 321 \cdot 1^2 = 3 & \mbox{digit} & 10 \\ \frac{ 197 }{ 11 } & 197^2 - 321 \cdot 11^2 = -32 & \mbox{digit} & 1 \\ \frac{ 215 }{ 12 } & 215^2 - 321 \cdot 12^2 = 1 & \mbox{digit} & 34 \\ \end{array}$$

All solutions of equation $$p^2−321q^2=1$$ derives from modulo polynomial $$p+qx\equiv(12x-215)^j\pmod{x^2-321}$$ where $$j\in\mathbb Z^+$$

(215, 12)
(92449, 5160)
(39752855, 2218788)
(17093635201, 954073680)
(7350223383575, 410249463612)
(3160578961302049, 176406315279480)
(1359041603136497495, 75854305320712788)
(584384728769732620801, 32617174881591219360)
(251284074329381890446935, 14025309344778903612012)
(108051567576905443159561249, 6030850401080046961945800)


given the fundamental solution $$P,Q$$ then all solutions are given by $$P_n, Q_n$$, where $$n \in \mathbb{Z^+}$$ and $$(P + Q\sqrt{321})^n = P_n + Q_n\sqrt{321}$$

If you want an elementary method, you can write:

$$p^2-D q^2=1$$

$$(p-1)(p+1)=D q^2$$

If D can be factorized, then p-1 or p+1 must have common divisors with one or two factors of D. For example :

$$p^2-321q^2=1$$

$$(p-1)(p+1)=3\times 107 q^2$$

321 is odd so one of p or q must be even. Let q be even then we can write:

$$(p-1)(p+1)=3\times 107\times 2^2 q_1^2$$

This indicates that LHS must also have two even factors. so we must have:

$$(p_1-1)(p_1+1)=3\times (2 \times 107)2\times q^2$$

Suppose $$p_1-1=214$$$$p_1=215$$$$q=12$$

Where $$p ≡0\ mod(p_1)$$$$p-1≡0 \ mod (107)$$

Also $$q ≡ 0 \mod 12$$

You see this in solutions given by Dmitry.