Positive integral solutions to $\frac{m(m+5)}{n(n+5)}=p^2$, where $p$ is prime. Find all $(m,n)$ positive integers such that $\frac {m(m+5)}{n(n+5)}= p^2$ such that $p$ is a prime number.
I tried a lot but could not find a way to start, i cannot proceed with mod bashing please help!
 A: This does not answers your question in full, it is just a start of the analysis of the problem and it can be a way to start.
From $\dfrac{m(m+5)}{n(n+5)}=p^2$ we obtain $m(m+5)=p^2n(n+5)$.
If you view this as a quadratic equation in $n$ we obtain:
$p^2n^2+5p^2n-m(m+5)=0$.
The solutions are $n=\dfrac{-5p^2+\sqrt{25p^4+4p^2m(m+5)}}{2p^2}$
The expression under the square-root sign must be a square of an integer so we have: $25p^4+4p^2m(m+5)=w^2$
If you view even this as a quadratic equation in the variable $p^2=r$ you obtain:
$25r^2+4rm(m+5)-w^2=0$
The solutions are $r=\dfrac{-4m(m+5)+\sqrt{(4m(m+5))^2+(10w)^2}}{50}$
The expression under the square-root sign must be a square of an integer so we have:
$(4m(m+5))^2+(10w)^2=h^2$
so, we obtained a Pythagorean triples and so much is known about them.
Now you can find, for example, on Wikipedia, what form must Pythagorean triples have and deduce something about the solutions.
There are many conditions here and from all of them you can say something about the solutions.
A: Numerically:
? for(m=2,10^5,for(n=1,m-1,p2=m*(m+5)/(n*(n+5));if(issquare(p2)&&p2==floor(p2),p=sqrtint(p2);if(isprime(p),print1("("n","m","p"), ")))))
(1,3,2), (2,9,3), (1,10,5), (7,16,2), (6,22,3), (9,121,11), (19,147,7),

Let $n$ is parameter, $2m+5\to x$, $2p\to y$, then solving of Pell equation $x^2-n(n+5)y^2=25$ can help us filter out solutions of source problem.
