I want all the solutions to this Diophantine Equation

I want all the solutions to this Diophantine equation. p and q are integers.

$$13pq \pm 1 = p^2 + 21 q^2$$

Solutions always come in pairs. $$p=2$$ and $$q=1$$ is one solution and so necessarily $$p=-2$$ and $$q=-1$$ is also a solution. Note that p and q must either both be positive or both be negative.

$$13 \cdot 2\cdot 1 = 26$$

$$2^2 + 21\times 1 ^2 = 4 + 21 =25$$

$$26 - 1 = 25$$

I want to find four other pairs of solutions to this equation. If no other solutions are possible, I want a proof of the impossibility of any other solutions.
Can anyone help ?!

• Please consider using MathJax to format your equations. Also, it is recommended to provide context and own efforts in order to get better support, see the guidelines on how to ask a good question. Commented Dec 13, 2023 at 8:02
• What do you think you’re using, Quora? And what is that +- stuff? Do you want + or -? Commented Dec 13, 2023 at 8:45
• As you said yourself, this is a Pell-type equation, hence an infinite series of solutions should be expected. Commented Dec 13, 2023 at 10:14

1- equation $$13pq-1=p^2+21q^2$$

We rewrite it as:

$$p^2-13pq+21q^2+1=0$$

We solve this equation for p:

$$\Delta=(13q)^2-4(21q+1)=85q^2-4$$

Let $$85q^2-4 =k^2$$, this is a Pell like equation which may have some solutions, for example for $$q=1$$ we have:

$$p^2-13p+22=0 \rightarrow k=\Delta=81\rightarrow p=11, p=2$$

You may find more solutions by searching or using brute force to find $$\Delta$$ as a perfect square.

2- Equation $$13pq+1=p^2+21q^2$$

We rewrite it as:

$$p^2-13pq+21q^2-1=0$$

$$\Delta=(13q)^2-4(21q-1)=85q^2+4$$

Now you have Pell like equation $$85q^2+4=k^2$$ to be solved. For example one solution is :

$$q=9\rightarrow k=\Delta=83^2$$ which gives $$p=100$$ and $$p=17$$.

You may find more solutions by solving the Pell like equation.