Is there the number `a, b, c, d, m` so that the equation has four integer solutions?
Try this:
FindInstance[
{(x - a) (x - b) (x - c) (x - d) == m,
a + d == b + c,
a < b < c < d,
{a, b, c, d, m, x} ∈ Integers},
{a, b, c, d, m, x}, 10
]
(* Out:
{{a -> 44, b -> 96, c -> 97, d -> 149, m -> 305331900, x -> -41},
{a -> 281, b -> 390, c -> 418, d -> 527, m -> 25162167780, x -> -4},
{a -> 597, b -> 662, c -> 663, d -> 728, m -> 139132605096, x -> 50},
{a -> 859, b -> 908, c -> 959, d -> 1008, m -> 709598061900, x -> 14},
{a -> -30, b -> 24, c -> 26,d -> 80, m -> -1834560, x -> -4},
{a -> 628, b -> 732, c -> 748, d -> 852, m -> 247761920016, x -> 30},
{a -> 667, b -> 791, c -> 792, d -> 916, m -> 336075509484, x -> 25},
{a -> 26, b -> 58, c -> 60, d -> 92, m -> 49040640, x -> -28},
{a -> 33, b -> 126, c -> 127, d -> 220, m -> 122147584, x -> -1},
{a -> 53, b -> 54, c -> 55, d -> 56, m -> 1413720, x -> 20}}
*)
Editon
result1 =
FindInstance[{Apply[Times, t - {b - e, b, c, c + e}] == m, e > 0,
b < c, m != 0}, {t, b, c, e, m}, Integers, 1000];
result2 = Apply[Times, x - {b - e, b, c, c + e}] == m /. result1;
result3 = Select[result2, Length[Solve[#, x, Integers]] == 4 &];
result4 = {#, Solve[#, x, Integers]} & /@ result3;
TextGrid[result4, Frame -> All]
Original
We set $b-a=d-c=e>0$,and set $b<c$, then we solve $(t-a)(t-b)(t-c)(t-d)=m$ ,here we assume that all of $b,c,e,t$ are integers, so such equations have at least one integers solution.
After that we select the equations which exactly have 4 integers solutions from above equations.
m = 180;
result1 =
FindInstance[{Apply[Times, t - {b - e, b, c, c + e}] == m, e > 0,
b < c, Alternatives[{t, b, c, e}] ∈ Integers}, {t, b, c,
e}, Integers, 100];
result2 = Apply[Times, x - {b - e, b, c, c + e}] == m /. result1;
result3 = Select[result2, Length[Solve[#, x, Integers]] == 4 &];
result4 = {#, Solve[#, x, Integers]} & /@ result3;
TextGrid[result4, Frame -> All]
My first, deleted answer is garbage since I misunderstood the question. Hopefully, this answer is not a waste of bandwidth.
Consider the quartic equation $(x-a)(x-b)(x-c)(x-d)=m$, where $\{a,b,c,d,m\}$ are integers. We are looking for values of $\{a,b,c,d,m\}$ such that there are four distinct integer solutions $x_i=\{x_1,x_2,x_3,x_4\}$. Imposing the constraint $a+d=b+c$ reduces the search to the four integers $\{a,b,c,m\}$.
The solution for $x_i$ with the constraint $a+d=b+c$ is as follows. Note that without the constraint, the solution is far, far more complicated.
FullSimplify[Solve[(x - a)(x - b)(x - c)(x - (b + c - a)) == m, x]]
The argument inside the outer square root admits a simplification.
Simplify[2 a^2 + b^2 + c^2 - 2 a (b + c) - ((a - b)^2 + (a - c)^2)]
0
In addition, make the substitution $r=a-b$ and $s=a-c$. The general form for the four solutions $x_i$ of the constrained quartic is a remarkably simple result!
$x\rightarrow \frac{1}{2} (b + c \pm \sqrt{r^2 + s^2 \pm 2 \sqrt{r^2 s^2 + 4 m}})$
where the $\pm$ signs are independent.
For the solutions $x_i$ to be real, the arguments of the square roots must be non-negative. Define integers $\{y,w,z\}$ such that $y^2=r^2 s^2+4m$, $w^2=r^2+s^2-2y$, and $z^2=r^2+s^2+2y$.
These definitions determine the four solutions as $x_i=(b+c+\{-w,w,-z,z\})/2$.
Adding gives $w^2+z^2=2(r^2+s^2)$, where the right-hand side is known in terms of the given $\{a,b,c\}$. Therefore, represent $2(r^2+s^2)$ as the sum of the squares of two distinct positive integers $w$ and $z$, then form the four solutions $x_i$. The corresponding value of $m=((w^2-z^2)^2-16r^2 s^2)/64$.
PrimitiveSumTwoSquares
and SquareDivisors
are helper routines for SumTwoSquares
.
PrimitiveSumTwoSquares[n_] :=
Block[{r, a, s},
If[(r = PowerModList[-1, 1/2, n]) == {}, {},
Table[
a = n;
s = r[[i]];
While[a^2 >= n, {s, a} = {a, Mod[s, a]}];
{Mod[s, a], a},
{i, Length[r]/2}]
]]
SquareDivisors[n_] :=
Sort[Flatten[
Outer[Times, Sequence @@ Map[#[[1]]^Range[0, #[[2]], 2] &, FactorInteger[n]]]]]
SumTwoSquares[n]
finds primitive and non-primitive representations $\{w,z\}$ of $n=w^2+z^2$ for positive $w$ and $z$ with $w<z$.
SumTwoSquares[n_] :=
Flatten[Table[
Sqrt[d]*PrimitiveSumTwoSquares[n/d], {d, SquareDivisors[n]}], 1]
Given $\{a,b,c\}$, quarticSolution[{a,b,c}]
returns valid $\{a,b,c,d,m,\{x_1,x_2,x_3,x_4\}\}$ with non-zero $m$.
quarticSolution[{a_, b_, c_}] :=
Block[{d, r, s, wz, mxi},
d = b + c - a;
r = a - b;
s = a - c;
wz = SumTwoSquares[2 (r^2 + s^2)];
mxi =
Map[{
((#[[1]]^2 - #[[2]]^2)^2 - 16 r^2 s^2)/64,
((b + c) + {-#[[1]], #[[1]], -#[[2]], #[[2]]})/2} &, wz];
Map[Join[{a, b, c, d}, #] &, DeleteCases[mxi, {0, _}]]
]
m2016[k]
returns $\{a,b,c,d,m,\{x_1,x_2,x_3,x_4\}\}$ such that $-k<a<b<c<d<k$, where $d=b+c-a$.
A solution $x_i$ corresponding to $\{a,b,c,d\}$ is essentially the same as the solution $-x_i$ corresponding to $-\{d,c,b,a\}$. Use DeleteDuplicates
to eliminate these redundant cases.
m2016[k_] :=
Block[{v},
v = Flatten[Table[
{a, b, c},
{a, -k + 1, k - 4},
{b, a + 1, k - 3},
{c, b + 1, Min[k - 2, a - b + k - 1]}], 2];
SortBy[
DeleteDuplicates[
Flatten[Map[quarticSolution, v], 1],
Sort[Last@#1] == Sort[-Last@#2] &],
#[[5]] &]
]
For example,
m2016[8]
{{-7, -1, 0, 6, -360, {-4, 3, -6, 5}}, {-7, -3, 0, 4, -180, {-5, 2, -6, 3}}, {-6, -2, 1, 5, -180, {-4, 3, -5, 4}}, {-7, -6, 1, 2, 180, {-4, -1, -8, 3}}, {-6, -5, 2, 3, 180, {-3, 0, -7, 4}}, {-5, -4, 3, 4, 180, {-2, 1, -6, 5}}, {-7, -5, 2, 4, 360, {-2, -1, -8, 5}}, {-6, -4, 3, 5, 360, {-1, 0, -7, 6}}, {-7, -5, 4, 6, 504, {-3, 2, -8, 7}}, {-7, -4, 4, 7, 720, {-1, 1, -8, 8}}, {-7, -6, 5, 6, 1260, {-1, 0, -9, 8}}, {-7, -6, 6, 7, 1440, {-2, 2, -9, 9}}}
Pick solutions with a given $m$.
Pick[#, #[[All, 5]], 504] &[m2016[15]]
{{-14, -12, -3, -1, 504, {-10, -5, -15, 0}}, {-13, -11, -2, 0, 504, {-9, -4, -14, 1}}, {-12, -10, -1, 1, 504, {-8, -3, -13, 2}}, {-11, -9, 0, 2, 504, {-7, -2, -12, 3}}, {-10, -8, 1, 3, 504, {-6, -1, -11, 4}}, {-9, -7, 2, 4, 504, {-5, 0, -10, 5}}, {-8, -6, 3, 5, 504, {-4, 1, -9, 6}}, {-7, -5, 4, 6, 504, {-3, 2, -8, 7}}}
It works reasonably fast.
AbsoluteTiming[Length[m2016[20]]]
{2.41968, 798}