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}
x (2 + x) (11 + x) (13 + x) == 504, x]
prove that, my question exist. $\endgroup$