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.
 A: The fact that $p$ is prime is something of a red herring.
Suppose that $$\sqrt{\frac{x+7}{9x-1}}$$
is rational for some positive integer $x$.
Then for some positive integers $k$, $a$, and $b$, we have the equations 
$$x+7=ka^2$$
and $$9x-1=kb^2$$
Multiplying the first equation by $9$ and subtracting the second equation from it, we get
$$64=k(9a^2-b^2)=k(3a-b)(3a+b)$$
Now each of $k$, $3a-b$, and $3a+b$ is a positive factor of $64$. As a reminder, $64$ has seven positive factors: $1$, $2$, $4$, $8$, $16$, $32$, and $64$.
Note that the terms $3a-b$ and $3a+b$ add up to be $6a$, so the sum of these terms must be divisible by $6$. Using this criteria, we can quickly reduce the possible pairs $(3a-b,3a+b)$ to 
$(2,4)$, $(2,16)$, $(2,64)$, $(4,8)$, $(4,32)$, $(8,16)$, $(8,64)$, and $(16,32)$. However, the products of these pairs is greater than $64$ in all cases except  $(2,4)$, $(2,16)$, and $(4,8)$.
Now, solving the resulting equations for $k$, $a$, and $b$, we get the possible solutions $(k,a,b)$ as $(8,1,1)$, $(2,3,7)$, and $(2,2,2)$. These then correspond to solutions for $x$ (we use here $x=ka^2-7$) - giving us $x=8-7=1$, $x=18-7=11$, and $x=8-7=1$. Hence the only positive integers which make
$$\sqrt{\frac{x+7}{9x-1}}$$
rational are $1$ and $11$. 
Finally, since we are asked for all prime solutions, we have the only solution as $p=11$.
A: 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$.
