I want to find the coefficients $a$, $b$, $c$, $d$, $e$, $k$ of the equation $$\sqrt{a x+b}+\sqrt{c x+d}=\sqrt{e x+k},$$ where $a$, $b$, $c$, $d$, $e$, $k$ belongs to $[-8,8]$ and different from 0 so that the given equation has two integer solutions (different from 0). For example, the equation $$\sqrt{6-x}+\sqrt{2x-3}=\sqrt{3x+3}$$ has two solutions $x=2 \lor x=3.$
I tried
ClearAll[a, b, c, d];
sol = x /.
Solve[{Sqrt[a x + b] + Sqrt[c x + d] == Sqrt[e x + k] } , x, Reals];
ClearAll[f];
(f[{a_, b_, c_, d_, e_, k_}] :=
Quiet@Check[And @@ (IntegerQ /@ #), False]) &[sol]
poss = Select[
Tuples[Range[-8,
8], {6}], #[[1]] #[[3]] #[[5]] #[[2]] #[[4]] #[[6]] =!= 0 &&
Sqrt[#[[2]]] + Sqrt[#[[4]]] - Sqrt[#[[6]]] =!=
0 && #[[1]] > #[[3]] && f[#] &];
Take[poss, Length[pReoss]];
With[{s = sol},
getSolution[poss_] :=
Block[{a, b, c, d, e, k}, {a, b, c, d, e, k} = poss;
Join[poss, s]]]
getSolution /@ poss
But, this code runs too long and I can't get the solution. How can I reduce the execution time?
Compile[]
it? (See link.) $\endgroup$