<s>[INST] Finding all primes $p,q$ with $p^2+q^2=9pq-13$ The last month I was trying to solve a problem of a magazine, and I found the following equation $$p^2+q^2=9pq-13,$$
Where $p$ and $q$ are primes. We need to get solutions when $p$ and $q$ are odd, because if any of them is even, the only solution that works is $(2,17)$. Any ideas will be much appreciated.
I analyzed the discriminant of the quadratic equation and we need to find solutions of $77q^2-52=k^2$, this is a variation of Pell's equations.
 [/INST] This answer will find all integer answers. Don't know if there is an easy way to find prime answers.
Multiplying by $4$ we get $4p^2-36pq+4q^2=-52$ or $(2p-9q)^2-77q^2=-52$.
Now, if there is a solution to $x^2-77y^2=-52$, with $x,y>0$ then we have that $x,y$ must have the same parity, and we take. 
$$\begin{align}x_1+y_1\sqrt{77}&=(x+y\sqrt{77})\left(\frac{9}{2}-\frac{1}{2}\sqrt{77}\right)\\
&=\frac{9x-77y}{2}+\frac{9y-x}{2}\sqrt{77}
\end{align}$$
If $x$ is the smallest positive integer solution, then we have that:
$$\left|\frac{9x-77y}{2}\right|\geq x$$
So either $x\geq 11y$ or $7y\geq x$. Which means that either $-52=x^2-77y^2\geq 44y^2$ which isn't possible, or $-52=x^2-77y^2\leq -28y^2,$ so the only possible value for $y$ is $y=1$, and this gives $x=5.$
So there are infinitely many solutions, all of the form $$X+Y\sqrt{77}=(5+\sqrt{77})\left(\frac{9}{2}+\frac{1}{2}\sqrt{77}\right)^k$$
Then $q=Y, p=\frac{X+9Y}{2}$.
</s>