Task 4. Let $m \geq 3$ and $n$ be positive integers with $n > m(m-2)$. Find the largest positive integer $d$ such that $d \mid n!$ and $k \nmid d$ for all $k \in \{m, m+1, \ldots, n\}$.
Solution. We will prove that $d=m-1$ is the largest that satisfies. First note that $m-1 \mid n$ ! and for $k \geq m$ we have $k \nmid m-1$, so $d=m-1$ indeed satisfies. Now suppose that for some $d$ we have: $d \mid n$ ! and $k \nmid d$ for all $k \in\{m, m+1, \ldots, n\}$. We will prove that $d \leq m-1$. Write $d=p_{1} p_{2} \cdots p_{t}$ with $p_{i}$ prime for all $i$ (not necessarily all distinct). If $t=0$, then $d=1 \leq m-1$, so we may assume $t \geq 1$. From the first condition on $d$ it follows that $p_{i} \leq n$ for all $i$. From the second condition on $d$ it follows that $p_{i} \notin\{m, m+1, \ldots, n\}$ for all $i$. Thus $p_{i} \leq m-1$ for all $i$. Now consider the numbers $p_{1}, p_{1} p_{2}, \ldots, p_{1} p_{2} \cdots p_{t}$. These are all divisors of $d$ and therefore all different from numbers in $\{m, m+1, \ldots, n\}$. Furthermore, we know that $p_{1} \leq m-1$. Now consider the largest $j \leq t$ for which $p_{1} p_{2} \cdots p_{j} \leq m-1$. If $j<t$ then

$$
p_{1} p_{2} \cdots p_{j} p_{j+1} \leq(m-1) p_{j+1} \leq(m-1)(m-1)=m(m-2)+1 \leq n
$$

But that means that $p_{1} p_{2} \cdots p_{j} p_{j+1} \leq m-1$ as well. Contradiction with the maximality of $j$. So it must be that $j=t$, i.e., $d=p_{1} p_{2} \cdots p_{t} \leq m-1$.

We conclude that $d=m-1$ is indeed the largest $d$ that satisfies the conditions.