<s>[INST] Find all the prime numbers that satisfy the following conditions There was a brainteaser in the Science Magazine from University of Hong Kong which is as follow:
Find all the prime numbers $p$ such that $\sqrt{\frac{p+7}{9p-1}}$ is rational.
I tried a few numbers and it seems to suggest that $11$ is a suitable candidate.
Can I know the techniques to approach this question?
Thank you.
 [/INST] Let the rational number be $a/b$ in lowest terms.  Rearrange the expression to $$p=\frac{a^2+7b^2}{9a^2-b^2}$$
Let $q$ be a prime factor of both numerator and denominator.  Either $3a+b$ or $3a-b$ is a multiple of $q$, so $b=\pm3a+nq$ for some whole number $n$.  Then $a^2+7b^2=a^2+7(9a^2+mq)$ for another whole number $m$, so $q$ is factor of $64a^2$.
If $q$ is a factor of $a$, and it is a factor of $3a+b$ or $3a-b$, then it is a factor of $b$ as well.  That is a contradiction since $a/b$ is in lowest terms, so $q$ is a factor of 64.
$q$ was prime, so $q=2$, and the denominator is a power of 2.
$3a+b$ and $3a-b$ are both powers of $2$, so $a=(2.4^k+1)/3,b=2.4^k-1$.  The denominator is $8.4^k$
Nine times the numerator is $$(2.4^k+1)^2+63(2.4^k-1)^2\\=256.4^{2k}-248.4^k+64=8.4^k(32.4^k-31)+64$$ This is a multiple of $8.4^k$, so $64$ is a multiple of $8.4^k$ and $k=0$ or $k=1$.
</s>