7. Suppose positive integers m,n satisfy
f(m,n)=2018.
For the integer solutions (x,y,z) of the system of equations (1):
if x=y=z, then it is called the 1st type solution;
if exactly two of x,y,z are equal, then it is called the 2nd type solution;
if x,y,z are all distinct, then it is called the 3rd type solution.
Let the number of the i-th type solution be ai.
Since the integer solutions (x,y,z) of the system of equations (1) remain solutions after permuting the components, we have
3∣a2,6∣a3.
Thus, a1=a1+a2+a3=2018≡2(mod3).
This indicates that the number of integer roots of the equation
x3−3x−m=0
satisfying ∣x∣⩽n is congruent to 2 modulo 3. Hence, it has at least two integer roots, denoted as α,β.
By the properties of cubic equations, the third root of equation (2) is a real number, denoted as γ. According to Vieta's formulas, we have
α+β+γ=0,
{αβ+βγ+γα=−3,αβγ=m.
Thus, γ=−α−β∈Z.
Assume α⩽β⩽γ.
From αβγ=m>0, we know α⩽β<0<γ.
Then −3=αβ+(α+β)(−α−β)
=−α2−αβ−β2⩽−3.
This implies α=β=−1.
Thus, γ=2,m=2.
Next, consider the system of equations (1) under m=2.
Notice that, (2n+1)3⩾2018 (there are only (2n+1)3
integer triples (x,y,z) satisfying ∣x∣、∣y∣、∣z∣ are all no greater than n).
Thus, n⩾6.
Next, calculate a1、a2、a3.
(1) Since −1,2 are all integer solutions of x3−3x−2=0, the triples
(−1,−1,−1)、(2,2,2) are all the 1st type solutions of the system of equations (1), i.e., a1=2.
(2) For the 2nd type solutions, assume y=z=x, substituting into
the system of equations (1) gives
xy2=x+2y+2
⇒(y+1)(x(y−1)−2)=0.
When y=−1, (x,−1,−1)(−n⩽x⩽n,
x=−1) are 2n 2nd type solutions;
When y=−1, from x(y−1)=2, we have
{x=±2,±1,y−1=±1,±2
Noting that x=y, we have
(x,y)=(−2,0),(1,3)
satisfying the conditions.
Considering the permutations of x,y,z, the number of 2nd type solutions
a2=3(2n+2).
(3) For the 3rd type solutions (x,y,z), consider the number of the corresponding 3-element sets {x,y,z}.
First, −1∈/{x,y,z} (otherwise, assume z=−1, substituting into the system of equations (1) and rearranging gives
(x+1)(y+1)=0⇒−1∈{x,y},
contradicting that x,y,z are all distinct).
If 0∈{x,y,z}, assume z=0, substituting into the system of equations (1) gives x+y=−2. Then
{x,y,z}={k,−2−k,0}(k=1,2,⋯,n−2)
are n−2 3-element sets.
If 0∈/{x,y,z}, assume y、z have the same sign, and
∣y∣⩾∣z∣.
When ∣z∣=1, we must have z=1, substituting into the system of equations (1) and rearranging gives
(x−1)(y−1)=4.
Noting that x=y,xy=0, we have
(x,y)=(5,2),(2,5)
satisfying the conditions. Thus,
{x,y,z}={1,2,5}.
When ∣z∣⩾2, from x=yz−1y+z+2, we have
∣x∣⩽∣y∣∣z∣−1∣y∣+∣z∣+2⩽2∣y∣−12∣y∣+2
=1+2∣y∣−13⩽2.
The equality cannot hold simultaneously (otherwise, we must have ∣x∣=∣y∣=∣z∣=2, and (x,y,z) would not be a 3rd type solution), thus, ∣x∣<2,x=1.
This implies, {x,y,z}={1,2,5}.
Therefore, the 3-element sets {x,y,z} corresponding to the 3rd type solutions of the system of equations (1) are n−1.
Thus, a3=6(n−1).
Combining (1), (2), and (3), we have for any n⩾6,
a1+a2+a3
=2+3(2n+2)+6(n−1)
=12n+2.
Since a1+a2+a3=f(m,n)=2018, we have
n=168.
In summary, when and only when m=2,n=168,