# A Diophantine equation involving factorial

Does the following diophantine equation have no positive integer solutions? $$x^3-y^3=z!$$

Many problems involving diophantine equations are hard. Is it an open problem? I hope someone can give some references for this question.

• Seems that the only triples that satisfy this equation , assuming $z\ge 1$, are $(0,-1,1)$ , $(1,-1,2)$ and $(1,0,1)$. This would imply that there is no positive integer solution. But I think a proof will be difficult. – Peter Mar 27 '17 at 13:32
• @appreant I do not know whether this helps , but a difference of two cubes can be written as $$(a+b)^3-a^3=3a^2b+3ab^2+b^3=b(3a^2+3ab+b^2)=\frac{b(3(2a+b)^2+b^2)}{4}$$ The numerator in the last expression has a factor of the form $3u^2+v^2$ , maybe we can find a contradiction by considering the possible prime factors of this factor. – Peter Mar 27 '17 at 20:51
• According to my calculations with PARI/GP using the thue-equation-routine the factorials from $3!$ to $27!$ are not the difference between two cubes. – Peter Apr 10 '17 at 22:18

See abc-conjecture. Probably this problem has some easy tricky solution, but most likely it doesn't. However, abc-conjecture implies it has only finitely many solutions (see below), and if any explicit bounds will be proven (which is not the case today AFAIK), then one may probably brute-force $z$'s to prove it has no solutions (for fixed $z$ with known factorization this doesn't seem hard).

Denote $c=x^3, a=y^3, b=z!$, so we have $a+b=c$. Then $$rad(abc)=rad(z!xy)\le xy\cdot rad(z!)$$ $rad(z!)$ is the product of primes up to $z$ and you can prove that this is smaller than $z!^{\delta}$ for any $\delta>0$ for large enough $z$, because the density of primes among all positive integers is zero. But then $$rad(abc)^{1+\varepsilon}\le x^{1+\varepsilon}y^{1+\varepsilon}(z!)^{\delta(1+varepsilon)}\le x^{2+2\varepsilon+\delta(1+\varepsilon)}< x^3=c$$ for large enough $z$ and small enough $\delta,\varepsilon>0$. Then abc-conjecture asserts that there exist only finitely many such $a,b,c$.

• In principle, it is easy to check whether $z!$ is the difference of two cubes using its factorization. The problem is that the number of divisors grows rapidly. An easy criterion if a number can be written as the difference of two cubes without needing the divisors would be very useful. – Peter Mar 28 '17 at 10:11
• @Peter To be honest, I don't know a polynomial-time (in length of a factorization) way to check if the number is a sum/difference of two cubes. And I found nothing here: oeis.org/A045980 – Wolfram Mar 28 '17 at 18:48
• In fact, there seems to be no efficient way. Can you figure out how far we have to test $x$ and $y$ such that we can be sure that the $abc$-conjecture implies that there are no positive solutions (and not just finite many) ? – Peter Mar 28 '17 at 20:00
• I am not sure whether the abc-conjecture covers all possible triples $(x,y,z)$ How do we know that $(x^3,y^3,z!)$ must be a coprime triple ? This is a crucial restriction in the abc-conjecture. – Peter Mar 29 '17 at 8:26
• In many cases, we can assume that the triple must be coprime because if a solution exists , a coprime solution exists as well. But here, we cannot divide the cube out because the number $\frac{z!}{p^3}$ is not a factorial anymore in general. – Peter Mar 29 '17 at 8:31

I wrote a routine "cubes" in PARI/GP. For $n>1$ it checkes whether $n$ is the difference of two cubes :

cubes(n)={gef=0;w=factor(n);u=component(w,1)~;v=component(w,2)~;forvec(z=vector(length(v),m,[0,v[m]]),t=prod(j=1,length(v),u[j]^z[j]);if((gef==0)*(t^3<n),if(issquare((12*n-3*t^3)/t)==1,gef=1)));gef}


The routine is based on the fact that with $a:=x-y$ , $k:=3(x+y)$ , $N:=x^3-y^3$ we have $$3a^3+ak^2=12N$$

So, $N>1$ is the difference between two cubes if and only if for some $a|N$, the number $\frac{12N-3a^3}{a}$ is a perfect square. Since I required $a^3<n$ in the program, the program returns "$0$" if $N$ is a cube.

This is because $N=x^3-y^3$ and $y=0$ is ruled out and a solution with $y>0$ cannot exist because we would have a counterexample for Fermat's last theorem for exponent $3$. Anyway, a factorial (besides $1$) cannot be a cube, so this case plays no role.

The following program (I copied the output after some minutes, so the program is not finished!) shows that no factorial $z!$ with $2\le z\le 35$ is the difference between two cubes. I will continue the search.

? gefunden=0;j=0;while(gefunden==0,j=j+1;print1(j," ");if(cubes(j!)==1,gefunden=
1))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36

• I arrived at $z=40$ without finding a solution. – Peter Apr 11 '17 at 11:10
• Hey if you are having problems with large numbers because of factorial consider finding the cube free part of $z!$ and solving $x^3-y^3=\text{cube free part of z!}$,if a solution exists then $(ax,ay,z)$ is a solution for $a^3=\text{cube part of z!}$. – kingW3 Apr 12 '17 at 21:38
• @kingW3 Of course, I tried this already and I am currently trying it again. I am currently at $89!$. You are right, if we are successful with the cubefree-part, we have found a solution. The converse is however not true. For example, $523$ is not the difference of two cubes, but $2^3\cdot 523=17^3-9^3$ is. For a real breakthrough, we probably need an even better condition when a number is a difference of two cubes. I have not detected any useful structrue yet. – Peter Apr 13 '17 at 16:52
• I came to $107!$ if only the cubefree part is used. – Peter Apr 13 '17 at 21:48
• You're right, I've thought about methods to chech whether its a difference of cubes but came empty-handed. Out of curiosity is it time consuming to compute factorials in PARI/GP, when I get time I'll try to chip in and help :P – kingW3 Apr 14 '17 at 20:36

I focussed on the posible values of $$t=x-y$$ and I used two approaches. Combined we can exclude numerically many cases by showing that $$t>\sqrt(z!)$$. First, I applied Wilson's theorem.

Wilson's theorem states that if $$p$$ is a prime, we have $$(p-1)! \equiv p-1 \pmod{p}$$. If $$p$$ is a prime number larger than $$z$$, we have $$(p-1)!=z!.[(z+1) \dots (p-1)] = \big( (t+y)^3-y^3 \big) .[(z+1) \dots (p-1)] \equiv p-1 \pmod{p}$$

An example. Suppose $$z=10$$ and $$p=13$$. Than $$(z+1) \dots (p-1) = 11.12$$. We can solve $$t,y$$ modulo $$13$$, and find $$t \pmod{13} \in \{1, 3, 4, 7, 8, 9, 10, 11, 12\}$$. This seems not a very fruitful result as only $$0,2,5,6$$ are excluded. But $$p$$ is arbitrary! This implies that if for each $$p$$ there is at least one residu missing modulo $$p$$, the number of possible values for t increases. As it is obvious that for a given $$z$$ the value of $$t$$ is bounded, we have only to consider a finite number of primes larger than $$z$$.

$$\begin{array}{c|l|c} \text{modulo} & \text{possible residues} & \text{minimal} \\ \text{prime p} & \text{for z=10} & \text{value t} \\ \hline 11 & [2, 4, 5, 6, 9, 10] & 2\\ 13 & [1, 3, 4, 7, 8, 9, 10, 11, 12] & 4\\ 17 & [2, 5, 7, 8, 9, 10, 11, 14, 16] & 9 \\ 19 & [2, 3, 4, 6, 9, 10, 13, 14, 15] & 9 \\ 23 & [5, 6, 7, 8, 12, 13, 15, 16, 18, 19, 20, 21] & 42 \\ 29 & [1, 2, 3, 4, 9, 11, 12, 13, 15, 16, 18, 20, 21, 23, 25] & 42 \\ 31 & [2, 4, 6, 7, 8, 9, 10, 11, 12, 14, 19, 20, 21, 24, 26, 27, 29, 30] & 42 \\ 37 & [1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 20, 23, 26, 27, 29, 30, 31, 33, 34, 36] & 192 \\ 41 & [2, 3, 4, 6, 7, 11, 12, 15, 16, 17, 19, 20, 22, 24, 25, 27, 31, 36, 37, 39, 40] & 427 \\ \end{array}$$

The second approach is to use $$d=\gcd(x,y)$$ and to write $$x^3-y^3=d^2.t.\big((\frac{x}{d}-\frac{x}{d})^2+3\frac{x}{d}.\frac{y}{d}\big)$$ The last term has only prime divisors of the form $$q=3$$ and $$q-1 \equiv 0 \pmod{6}$$. Hence, all other prime factors of $$z!$$ are in $$d^2.t$$. If for a prime $$q \not = 3$$ we have $$(t,y) \simeq (q^n,q^m)$$, it is not difficult to show that if $$x^3-y^3 \simeq q^p$$ then $$p=n+2.\min(n,m)$$. The minimum value of $$n_{min}$$ given $$p$$ is related to the following sequence. For instance $$5^{24} \mid 100!$$ and $$n_{min}=8$$. Hence, $$5^8 \mid t$$.
If $$q=3$$ we have $$n_{min}=\lceil \frac{z}{3} \rceil$$. Combining we have for $$z=100$$ that $$2^{33}.3^{16}.5^8.11^3.17^3.23^2.29.$$ $$41^2.47^2.53.59.71.83.89 \mid t$$ as minimum requirement.

In total by using both methods, the test for $$z=100$$ stops at the prime number $$223$$ as than $$t>\sqrt(z!)$$. For $$z=150$$ we can stop at $$349$$.