For a given rational $c\ne-1$, I need to find a rational $x\ne20$ with a small denominator such that $(5cx+100)(5cx-64c+36)$ is a perfect square.


I start with


$y^2=(5cx+100)(5cx-64c+36)$


and complete the square to transform it to


$y^2+(32c+32)^2=(5cx-32c+68)^2$


A standard approach for non-primitive Pythagorean triples gives


$5cx-32c+68=\frac{k(m^2+n^2)}{2}$


$32c+32=\frac{k(m^2-n^2)}{2}$


which by addition/subtraction can be rewritten into


$5cx+100=km^2$


$5cx-64c+36=kn^2$


$y^2=(kmn)^2$


Solutions for $x$ and $k$ are below


$x = \frac{4(25n^2+16cm^2-9m^2)}{5c(m^2-n^2)}$


$k = \frac{64(c+1)}{m^2-n^2}$


**My questions:**


1. Is there a way to quickly find $m$ and $n$ such that the denominator
of $x$ is small? (e.g., similar to [Chakravala
method](https://en.wikipedia.org/wiki/Chakravala_method))
2. Is there a
way to transform this perfect square quadratic into an elliptic
curve?
3. How good of a solution for $x$ is it possible to find for $c= - \frac{37178488}{89505763}$ in a reasonable time?


**Example:**


For $c=\frac{41267184237}{443212989587}$, the values $|m|=1179067$ and $|n|=649029$ seem to produce the minimal solution $x=\frac{4}{5}$. But brute-forcing integer $m$ and $n$ takes much longer than brute-forcing a rational $x$ in this case.



Perfect square quadratic expression
1. The following Maple code is the fastest I could do.



```
restart:
with(numtheory):
mins1:=10^10:
mins2:=10^10:
c:=-37178488/89505763;
N0:=64*abs(numer(c+1)):
time0:=time():
for h from 1 to 10^10 do
    N:=h*N0:
    listN:=divisors(N):
    for i from 1 to nops(listN) do
        K:=listN[i]:
        P:=N/K:
        listP:=divisors(P):
        for j from nops(listP) to 1 by -1 do
            for sig from -1 to 1 by 2 do
                mpn:=listP[j]:
                mmn:=sig*P/mpn:
                if abs(mpn)>=abs(mmn) then
                    m:=(mpn+mmn)/2:
                    n:=(mpn-mmn)/2:
                    x:=4*(25*n^2+16*c*m^2-9*m^2)/(5*c*(m^2-n^2)):
                    if x<>20 then
                        s1:=abs(denom(x)):
                        if s1<mins1 then
                            mins1:=s1:
                            print("den-->min",x,K,m,n,h,time()-time0):
                        fi:
                        s2:=abs(numer(x))+abs(denom(x)):
                        if s2<mins2 then
                            mins2:=s2:
                            print("|num|+den-->min",x,K,m,n,h,time()-time0):
                        fi:
                    fi:
                fi:
            od:
        od: 
    od:
od:

```

3. The code produces no new results. I added tracking for minimizing a sum of the numerator and denominator of $x$. Both mentioned above answers are produced in 6 seconds.



```
"|num|+den-->min", 2075/43, 3, 2570, 33510, 1, .312
"den-->min", 3311/30, 1, 186272, 211528, 3, 5.694

```

