10

This is a "pupil-level" problem from a Chinese software Xiaohongshu (Chinese version Twitter/Reddit/Quora/Insta). Unfortunately, its "official" solution is wrong: The solution states that $m! - n!$ contains a prime factor larger than $m$, however $37! - 35! = 35! \times (36 \times 37 - 1) = 35! \times 11^3$.

I found this problem extremely hard for me. I can only prove partial results:

(1)If $m \geq 2n > 4$, then $m! - n!$ is never a square.

Proof: Let $p$ be the largest prime $\leq n$. According to the Bertrand's postulate, $p > \frac{n}{2}$. Therefore, $v_p(n!) = 1$. Since $m \geq 2n \geq 2p$, $v_p(m!) \geq 2$, therefore $v_p(m!-n!) = 1$, hence $m! - n!$ is not a perfect square.

(2)If $m = n+1$, then $m! - n!$ is never a perfect square.

Proof: $m! - n! = n \times n! = n^2 \times (n-1)!$. However, $(n-1)!$ is never a perfect square when $n \geq 2$ (see here if you are confused). Therefore $(n+1)! - n!$ is not a perfect square for $n \geq 2$.

(3) If $popcount(\lfloor \frac{n}{2} \rfloor)$ is odd, then $m! - n!$ is never a perfect square.

Proof: The case $m = n+1$ has been discussed in (2). For $m > n+1$, by Legendre's formula, $v_2(m) = \sum\limits_{i=1}^\infty \lfloor \frac{m}{2^i} \rfloor > v_2(n)$, however $v_2(n)$ is an odd number, therefore $v_2(m! - n!)$ is also odd.

We note that the parity of $v_2(n)$ equals $popcount(\lfloor \frac{n}{2} \rfloor)$, where popcount means the number of $1$ in a number's binary representation. For example, $popcount(7) = popcount(111_2) = 3$ and $popcount(6) = popcount(110_2) = 2$.

This problem, on the one hand, seems easy. Intuition and Python experiments show the $m! - n!$ are never perfect squares, as it is "somehow difficult" to make $v_p(m! - n!)$ even for every $p$. On the other hand, it is also difficult. When $m > n+1$, it might require analysis on the expression $\Pi_{i=n+1}^m i - 1$, while the term "$-1$" is quite annoying. I am curious whether it is possible to introduce some analytic or algebraic tools?

Muses_China
  • 1,008
  • 1
    This can probably be strengthened : For positive integers $a<b$ , $b!-a!$ seems only to be a perfect power for $a=2,b=3$. Upto $b=3\ 000$ , there is no further one. – Peter Dec 17 '23 at 15:50
  • 1
    See https://math.stackexchange.com/questions/4819935/factorial-equation-and-no-solution-existing-a-conjecture for analogous problem – Barackouda Dec 17 '23 at 17:24
  • 1
    It is known that a finite product of consecutive are never a power (Erdös). So if $m!-n!$ is a square then all prime factor of $n!$ whose exponent is not even should be also a factor of $(n+1)(n+2)\cdots (m-1)m-1$. It seems quite unlikely. – Ataulfo Dec 17 '23 at 18:52
  • 1
    Note that heuristically this number should be finite (and given the bounds that we have on a smallest example, probably zero): the 'probability' that a randomly chosen number $x$ is square is roughly $\frac1{\sqrt{x}}$, and thus the probability that any of the numbers between $(m+1)!-m!$ and $(2m)!-m!$ are square is bounded from above by $\sum_{k=1}^m\dfrac{1}{\sqrt{(m+k)!-m!}}$ $\leq \sum_{k=1}^m\dfrac1{\sqrt{m!}}=\dfrac {m}{\sqrt{m!}}$, and the last function there decreases superexponentially fast, so the sum over all $m$ is finite. – Steven Stadnicki Dec 17 '23 at 22:49

1 Answers1

1

There may be a very elementary way to prove this, but I don't see it. An old argument of Erdos and Oblath (from a paper in 1937) gives this result with finitely many exceptions. Using bounds for primes in intervals due to Rosser and Schoenfeld, it's not too hard to complete the proof. What Erdos and Oblath do is to split the cases depending on whether or not $$ m > n + \frac{n}{6 \log n} $$ and show that there exists a prime $p$ with $$ \frac{n}{2} < p < \frac{n}{2} + \frac{n}{12 \log n}, $$ for suitably large $n$. If we have $m > n + \frac{n}{6 \log n}$, then this prime $p$ shows up precisely once in $m!-n!$. If $m \leq n + \frac{n}{6 \log n}$, then an easy upper bound upon $m!/n!$ contradicts the fact that every prime in $(n/2,n)$ must divide what you obtain by factoring $n!$ out of $m!-n!$.

Mike Bennett
  • 3,614
  • 13
  • 12