# Finding positive integer solutions to $a!+5^b=7^c$

This question: "Solve: $$a!+5^b=7^c$$" was closed for lack of context, and probably lack of effort by OP. Nonetheless, the question is interesting in itself, and several particular solutions were given in the comments. I show here those given answers are nearly exhaustive, and pose a question about the one instance for which I have not yet obtained a which a full solution.

1. Based on parity alone, $$a!$$ must be even, hence $$a \ge 2$$

2. $$\min (a!+5^b)=2!+5^0=3$$, hence $$c \ne 0$$

3. If $$a\ge 7$$, then $$7\mid a! \land 7\mid 7^c \Rightarrow 7\mid 5^b$$. This is not possible, so $$a<7$$

4. Examine the case $$b=0$$. Here, $$2\le a \le 6 \Rightarrow a! \in \{2,6,24,120,720\}$$ and $$a!+5^0=a!+1 \in \{3,7,25,121,721\}$$. The only instance in which $$a!+5^0=7^c$$ is $$3!+5^0=7$$. Solution 1 is $$a=3,b=0,c=1$$

5. If $$b>0 \land a\ge 5$$, then $$5\mid a! \land 5\mid 5^b \Rightarrow 5\mid 7^c$$. This is not possible, so $$a<5$$

6. $$2\le a \le 4 \Rightarrow a! \in \{2,6,24\}$$. We can examine each of these three cases individually.

7. $$24+5^b=7^c$$ is analyzed modulo $$7$$ and modulo $$5$$. First, $$3+5^b\equiv 0 \bmod 7$$ is true when $$b$$ has the form $$6m+2$$. Next, $$4\equiv 7^c \equiv 2^c \bmod 5$$ is true when $$c$$ has the form $$4n+2$$. In order to have integer solutions, this equation must be formulated $$24+5^{6m+2}=7^{4n+2}$$. Rearranging, $$24=7^{2(2n+1)}-5^{2(3m+1)}$$. This is simply the difference of two squares, viz: $$24=(7^{(2n+1)}-5^{(3m+1)})(7^{(2n+1)}+5^{(3m+1)})$$. This resolves $$24$$ into two factors, both of which are even and have no common factors other than $$2$$. The possiblities for this are $$24=2\times 12$$ and $$24=4\times 6$$. Moreover, for $$m>1$$ or $$n>1$$, the factor $$(7^{(2n+1)}+5^{(3m+1)})$$ is much larger than $$24$$ itself, so the only possible candidate is given by $$m=n=0$$, which sets $$24=(7-5)(7+5)=2\cdot 12$$ which is true, leading uniquely to Solution 2: $$a=4,b=2,c=2$$

8. $$6+5^b=7^c$$ is analyzed modulo $$7$$ and modulo $$5$$. First, $$6+5^b\equiv 0 \bmod 7$$ is true when $$b$$ has the form $$6m$$. Next, $$1\equiv 7^c \equiv 2^c \bmod 5$$ is true when $$c$$ has the form $$4n$$. As before, we derive $$6=(7^{(2n)}-5^{(3m)})(7^{(2n)}+5^{(3m)})$$. This plainly has no solutions because each of the factors is even and contains at least one factor of $$2$$, but $$6$$ has only one factor of $$2$$. So there are no solutions in this instance.

9. $$2+5^b=7^c$$ is analyzed modulo $$7$$ and modulo $$5$$. First, $$2+5^b\equiv 0 \bmod 7$$ is true when $$b$$ has the form $$6m+1$$. Next, $$2\equiv 7^c \equiv 2^c \bmod 5$$ is true when $$c$$ has the form $$4n+1$$. In order to have integer solutions, this equation must be formulated $$2+5^{6m+1}=7^{4n+1}$$. By inspection, when $$m=n=0$$, we get Solution 3: $$a=2,b=1,c=1$$. Here I am stopped. Since a solution exists, it is not likely that I can rule out larger solutions (i.e. for $$mn \ge 1$$) by modular arithmetic, and since the exponents in this case are odd, I cannot use the difference of two squares trick which afforded solutions in the previous cases.

My question is: Is there a method or strategy for evaluating the existence and nature of solutions to $$2+5^{6m+1}=7^{4n+1}$$ for $$mn \ge 1$$?

• I believe (but am not certain) that $n=2$ is one of the known cases of the generalized Catalan Conjecture. Perhaps the references in that link would settle the issue.
– lulu
Commented Oct 15, 2021 at 17:20

## 3 Answers

If $$mn\geqslant 1$$, then one has $$5^{6m+1}\equiv 25\pmod{100}\qquad \text{and}\qquad 7^{4n+1}\equiv 7\pmod{100}$$ So, if $$mn\geqslant 1$$, then $$2+5^{6m+1}=7^{4n+1}$$ has no solutions.

• Great answer. Thanks! Commented Oct 15, 2021 at 17:52

Actually, as to your paragraph 9,

Since a solution exists, it is not likely that I can rule out larger solutions

is too pessimistic; a string of modular statements may work. Your $$7^m = 5^n + 2$$ becomes $$7^m -7 = 5^n -5$$ or $$7 (7^x - 1) = 5 ( 5^y - 1)$$ We assume $$x,y \geq 1$$ and hunt for a contradiction.

(I) since $$7^x \equiv 1 \pmod 5,$$ we calculate $$4 | x.$$ Well $$7^4 - 1 = 96 \cdot 25.$$ As $$4|x,$$ we know $$7^x - 1$$ is divisible by said $$2400;$$

(II) $$7^x - 1$$ is divisible by $$25 = 5^2,$$ but $$5(5^y-1)$$ is not divisible by $$25$$ Therefore $$7 (7^x - 1) \neq 5 ( 5^y - 1)$$

unless $$x,y=0;$$ there is no larger solution.

$$\bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc$$

here are some links on this method, including the guy from whom I learned it

https://math.stackexchange.com/users/292972/gyumin-roh

Exponential Diophantine equation $7^y + 2 = 3^x$ Gyumin Roh answer from 2015

Elementary solution of exponential Diophantine equation $2^x - 3^y = 7$.

Elementary solution of exponential Diophantine equation $2^x - 3^y = 7$. ME! 41, 31, 241, 17

Finding solutions to the diophantine equation $7^a=3^b+100$ 343 - 243 = 100

http://math.stackexchange.com/questions/2100780/is-2m-1-ever-a-power-of-3-for-m-3/2100847#2100847

The diophantine equation $5\times 2^{x-4}=3^y-1$

Equation in integers $7^x-3^y=4$

Solve in $\mathbb N^{2}$ the following equation : $5^{2x}-3\cdot2^{2y}+5^{x}2^{y-1}-2^{y-1}-2\cdot5^{x}+1=0$

Diophantine equation power of 7 and 2

Finding all natural $x$, $y$, $z$ satisfying $7^x+1=3^y+5^z$

$$\bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc$$

• Very good references! I can see now that mathlove's answer was not just a bit of arcane knowledge on his part, but can be logically arrived at. Thanks. Commented Oct 16, 2021 at 15:03

Once you establish $$2\le a\le4$$, you can treat the six possibilities with $$b\lt2$$ individually, so it remains to consider $$a!+5^b=7^c$$ with $$b\ge2$$, in which case we have $$7^c$$ mod $$25$$ is either $$2$$, $$6$$, or $$-1$$. But the powers of $$7$$ mod $$25$$ are $$1$$, $$7$$, $$-1$$, and $$-7$$. So the only possibility with $$b\ge2$$ is $$4!+5^b=7^c$$. Moreover, closer inspection of the powers of $$7$$ mod $$25$$ shows $$7^c\equiv-1$$ mod $$25$$ implies $$c$$ is even (and positive), at which point an argument mod $$8$$ tells us $$b$$ must also be even. Since $$7^{2m}-5^{2n}=(7^n-5^n)(7^n+5^n)\ge24$$ if $$m$$ and $$n$$ are both positive, we find $$4!+5^2=7^2$$ is the only solution with $$b\ge2$$.

(For completeness, of the six possibilities with $$b\lt2$$, only two are powers of $$7$$, namely $$3!+5^0$$ and $$2!+5^1$$.)