Are there Pell Equations $x^2 – dy^2 = n$ that are easy to solve

diophantine equationspell-type-equations

Consider the Pell equation $x^2 – dy^2 = n$ where $d$ is a positive non-square integer.

Are there examples of special $d$ that makes it easy to solve (obtain non-trivial solutions) the equation for any $n \in Z – \{ 0 \} $?

Note: To clarify the motivation behind this question, I have $n$ that needs to be represented in a Generalized Pell Equation form $(x^2 – dy^2)$. If we can freely choose $d$ positive non-square, can we make choice(s) for $d$, perhaps depending on $n$ (since some choices of $d$, $n$ do not permit solutions), that renders the equation easily solvable.

See related: Is every integer $z$ representable in Pell form as $x^2 \pm dy^2 =z$?

Best Answer

This is called the generalized Pell equation. As in the classical case there is an algorithm, based on simple continued fractions, due to Lagrange, which solves $$ x^2-dy^2=n $$ for any given squarefree $d$ and given $n\in \Bbb Z\setminus \{0\}$.

Reference: Section $6$ of Keith Conrad's notes.

I would not call this algorithm "trivial" but certainly it is well-known and easy to perform. For small $d$, like $d=2$ it might be a bit quicker, but still is non-trivial.

Related Question