<s>[INST] When is the fraction $\frac{n+7}{2n+7}$ the square of a rational number? 
Find all positive integers $n$ such that the fraction $\dfrac{n+7}{2n+7}$ is the square of a rational number.

The answer says $n = 9,57,477$, but how do we prove this? I wrote $\dfrac{n+7}{2n+7} = \dfrac{a^2}{b^2}$ for some $a,b \in \mathbb{Z^+}$ and $\gcd(a,b) = 1$. We know that $\gcd(n+7,2n+7) = \gcd(n+7,7) = 1,7$ and so $n+7$ and $2n+7$ must both be perfect squares or their greatest common divisor is $7$. How do we find all values for which this is the case?
 [/INST] There are more solutions (n<1000000):
$$
\begin{array}{c}
 9 \\
 57 \\
 168 \\
 477 \\
 2109 \\
 5880 \\
 16377 \\
 71817 \\
 199920 \\
 556509 \\
\end{array}
$$
so you just plug these values of $n$ and check otherwise the question does not make sense. Also One solution in your list is missing for n<500.
Added after observation of ross-millikan:
$n+7$ and $2n+7$ can have common multiplier, is so than $2*(n+7)-(2n+7)$ is also devisible by the same number which is clearly $7$, so the theorem is that if numerator and denominator have a common multiplier it can only be $7$. Thus we have two possibilities
a) $n+7=a^2$ and $2n+7=b^2$
b) $n+7=7 a^2$ and $2n+7=7 b^2$
for b) n should be divisible by $7$
</s>