Solution:
We claim the answer is 404. First, we notice that m≤2022. Otherwise,
m!x1(x1−1)⋯(x1−m+1)=m!2022(2022−1)⋯(2022−m+1)=0,
which is a multiple of 7. Then, since xn≥x1=2022 for all n, we can write
m!xn(xn−1)⋯(xn−m+1)=m!×(xn−m)(xn−m−1)⋯1xn(xn−1)⋯(xn−m+1)(xn−m)(xn−m−1)⋯1=m!(xn−m)!xn!.
For a positive integer n, we define ν(n) as the exponent of 7 in the prime factorization of n. For example, ν(1)=0 and ν(98)=2. Note ν(ab)=ν(a)+ν(b) and ν(a/b)=ν(a)−ν(b). We prove the following two Lemmas:
- Lemma 1:
ν(n!)=i=1∑d⌊7in⌋=⌊7n⌋+⌊49n⌋+⋯+⌊7dn⌋,
where d is the largest integer such that 7d≤n, for all non-negative integers n.
Proof: Note that
ν(n!)=ν(1)+ν(2)+⋯+ν(n).
ν(n!) has a contribution of +1 for each multiple of seven (less than or equal to n) and there are ⌊n/7⌋ such numbers. Each multiple of 49 contributes another +1 to ν(n!), and there are ⌊n/49⌋ such numbers. Generally, there is an additional +1 contributed for each multiple of 7i, of which there are ⌊n/7i⌋ numbers. Adding up all these contributions, we get the desired result.
- Lemma 2: ⌊x⌋−⌊y⌋−⌊x−y⌋≥0, for all reals x and y, with equality if and only if {x}≥{y}.
Proof: Let x=⌊x⌋+{x} and y=⌊y⌋+{y}. Then x−y=⌊x⌋−⌊y⌋+{x}−{y}. Since 0<{x},{y}<1, we have −1<{x}−{y}<1.
(a) If 0≤{x}−{y}<1, i.e. {x}≥{y}, then ⌊x−y⌋=⌊x⌋−⌊y⌋, so ⌊x⌋=⌊y⌋+⌊x−y⌋.
(b) Otherwise, ⌊x−y⌋=⌊x⌋−⌊y⌋−1, so ⌊x⌋>⌊x⌋−1=⌊y⌋+⌊x−y⌋.
Now we can use Lemma 1 to compute
ν(m!(xn−m)!xn!)=ν(xn!)−ν(m!)−ν((xn−m)!)=i=1∑d⌊7ixn⌋−i=1∑l1⌊7im⌋−i=1∑l2⌊7ixn−m⌋=i=1∑d(⌊7ixn⌋−⌊7im⌋−⌊7ixn−m⌋).
Here d is the largest integer such that 7d≤xn, l1 is the largest integer such that 7l1≤m, and l2 is the largest integer such that 7l2≤xn−m. Increasing the range of the sums does not affect the result, as we are simply adding terms of the form ⌊a/7b⌋, where 7b>a, which gives 0.
If we let x=xn/7i and y=m/7i, then this final sum consists of terms of the form ⌊x⌋−⌊y⌋−⌊x−y⌋≥0. Therefore, we get that
7 doesn’t divide m!xn(xn−1)⋯(xn−m+1)
if and only if
ν(m!(xn−m)!xn!)=0
if and only if
⌊7ixn⌋=⌊7im⌋+⌊7ixn−m⌋ for all 0≤i≤d
if and only if
{7ixn}≥{7im}
for all 0≤i≤d.
By Lemma 2. This must hold for all n. Notice
{7ixn}≥{7im} if and only if 7i{7ixn}≥7i{7im},
and 7b{a/7b} is simply the remainder of a modulo 7b. Hence we have
{7ixn}≥{7im} if and only if xn(mod7i)≥m(mod7i).
Since x1=2022=5⋅73+6⋅72+1⋅71+6⋅70, we inductively get
xn=5⋅7n+2+6⋅7n+1+1⋅7n+6⋅7n−1+5⋅7n−2+⋯+5⋅70.
Using this, we can find the smallest value of xn (mod 7i):
- For i=1, the smallest value is 5⋅70, when n≥2.
- For i=2, the smallest value is 1⋅71+6⋅70, when n=1.
- For i=3, the smallest value is 1⋅72+6⋅71+5⋅70, when n=2.
- For i=4, the smallest value is 1⋅73+6⋅72+5⋅71+5⋅70, when n=3.
- For i≥5, the smallest value is 5⋅73+6⋅72+1⋅71+6⋅70, when n=1.
Thus if we write m in the form m=a3⋅73+a2⋅72+a1⋅71+a0⋅70, where 0≤ai≤6, we must have a0≤5, a1≤1, a2≤1, and a3≤1, which are necessary and sufficient.
Therefore the maximum integer m is achieved when a0=5 and a1=a2=a3=1. This gives m=73+72+71+5=404.