# Solve : $\space 3^x + 5^y = 7^z + 11^w$

Solve the diophantine equation $3^x + 5^y = 7^z + 11^w$,here $x,y,z,w$ are all non-negative integers.

I find three solutions by force algorithm use Mathematica: (0,0,0,0)(1,1,1,0)(1,3,1,2).And there is no else when $y,z,w<100$.

#### Solutions Collecting From Web of "Solve : $\space 3^x + 5^y = 7^z + 11^w$"

I do not have access to that article referenced in the comments to the answer by @Lord_Farin (If anyone has access, I would be interested to know whether the approach is the same as mine.)

Many of these exponential Diophantine equations can be systematically solved through modular arithmetic, albeit a lot of it. The main idea is to consider the equation $\pmod{p^k}$ and $\pmod{q_k}$, where $p$ is one of the primes appearing in the equation, and $q_k=mp^{k-1}+1$, and $m$ has small prime factors. If all solutions have the power of $p$ less than some integer $n$, then repeating this procedure up to $k=n$ will probably give a contradiction. This allows us to bound the exponents, so that it suffices to check small cases. For example, we can successively consider $\pmod{3}, \pmod{9}, \pmod{7}, \pmod{27}, \pmod{19}, \pmod{81}, \pmod{109}$, etc. For more examples, see my answers here and here.

Let us continue with the proof:

$$3^x+5^y=7^z+11^w$$

If $x=0$, then if $y \geq 1$, taking $\pmod{5}$ gives $0 \equiv 7^z \pmod{5}$, a contradiction. Thus $y=0$, so $2=7^z+11^w$, so $z=w=0$. This gives the solution $(x, y, z, w)=(0, 0, 0, 0)$.

Otherwise $x \geq 1$. Taking $\pmod{3}$, we have $(-1)^y \equiv 1+(-1)^w \pmod{3}$. Thus $w$ is even and $y$ is odd. This implies that $y \geq 1$.

Taking $\pmod{4}$, $(-1)^x+1 \equiv (-1)^z+(-1)^w \equiv (-1)^z+1 \pmod{4}$, so $x \equiv z \pmod{2}$.

Taking $\pmod{5}$, we have $3^x \equiv 7^z+1 \pmod{5}$. Therefore $(x, z) \equiv (1, 1), (2, 3), (3, 0) \pmod{4}$. Since $x \equiv z \pmod{2}$, we must necessarily have $x \equiv z \equiv 1 \pmod{4}$. This implies that $z \geq 1$.

Taking $\pmod{16}$, we get $3+5^y \equiv 3^x+5^y \equiv 7^z+11^w \equiv 7+11^w \pmod{16}$. This implies that $(y, w) \equiv (1, 0), (3, 2) \pmod{4}$.

Taking $\pmod{7}$, we now have $3^x+5^y \equiv 4^w \pmod{7}$. This gives $$(x, y, w) \equiv (1, 1, 0), (1, 3, 2), (3, 1, 4), (3, 5, 2), (5, 3, 4), (5, 5, 0) \pmod{6}$$

Let us consider $x \geq 2$ first, and take $\pmod{9}$. We get $5^y \equiv (-2)^z+2^w \pmod{9}$. This gives $$(y, z, w) \equiv (5, 1, 2), (1, 1, 4), (3, 1, 0), (1, 3, 2), (3, 3, 4), (5, 3, 0), (3, 5, 2), (5, 5, 4), (1, 5, 0) \pmod{6}$$

Combining, we have $$(x, y, z, w) \equiv (1, 1, 5, 0), (1, 3, 5, 2), (3, 1, 1, 4), (3, 5, 1, 2), (5, 3, 3, 4), (5, 5, 3, 0) \pmod{6}$$

Combining with $(y, w) \equiv (1, 0), (3, 2) \pmod{4}$ gives:

$$(x, y, z, w) \equiv (1, 1, 5, 0), (1, 7, 5, 6), (1, 3, 5, 2), (1, 9, 5, 8), (9, 1, 1, 4), (9, 7, 1, 10), (9, 5, 1, 8), (9, 11, 1, 2), (5, 9, 9, 4), (5, 3, 9, 10), (5, 5, 9, 0), (5, 11, 9, 6) \pmod{12}$$

We now check $\pmod{13}$, and we shall get a contradiction. Since $\varphi(13)=12$, it suffices to check the 12 quadruplets above.

\begin{align}
3^1+5^1-7^5-11^0 \equiv 9 \pmod{13} \\
3^1+5^7-7^5-11^6 \equiv 1 \pmod{13} \\
3^1+5^3-7^5-11^2 \equiv 9 \pmod{13} \\
3^1+5^9-7^5-11^8 \equiv 1 \pmod{13} \\
3^9+5^1-7^1-11^4 \equiv 9 \pmod{13} \\
3^9+5^7-7^1-11^{10} \equiv 5 \pmod{13} \\
3^9+5^5-7^1-11^8 \equiv 3 \pmod{13} \\
3^9+5^{11}-7^1-11^2 \equiv 11 \pmod{13} \\
3^5+5^9-7^9-11^4 \equiv 3 \pmod{13} \\
3^5+5^3-7^9-11^{10} \equiv 12 \pmod{13} \\
3^5+5^5-7^9-11^0 \equiv 5 \pmod{13} \\
3^5+5^{11}-7^9-11^6 \equiv 10 \pmod{13}
\end{align}

Since none of the quadruplets give $0 \pmod{13}$, we get a contradiction.

Therefore $x=1$, and we now have the equation $$3+5^y \equiv 7^z+11^w$$

Consolidating the information we have thus far, we have $y, z \geq 1$, $z \equiv 1 \pmod{4}$, $(y, w) \equiv (1, 0), (3, 2) \pmod{4}$ and (since $x=1$) $(y, w) \equiv (1, 0), (3, 2) \pmod{6}$.

Taking $\pmod{9}$, we get $3+5^y-11^w \equiv 7^z \pmod{9}$, so if $(y, w) \equiv (1, 0) \pmod{6}$, then $7^z \equiv 3+5^1-11^0 \equiv 7 \pmod{9}$. If $(y, w) \equiv (3, 2) \pmod{6}$, then $7^z \equiv 3+5^3-11^2 \equiv 7 \pmod{9}$. In any case, $7^z \equiv 7 \pmod{9}$, so $z \equiv 1 \pmod{6}$.

Note that $7^6 \equiv 1 \pmod{43}$, so taking $\pmod{43}$ gives $3+5^y \equiv 7^z+11^w \equiv 7+11^w \pmod{43}$, which simplifies to $5^y \equiv 4+11^w \pmod{43}$. Note that $5^6 \equiv 16 \pmod{43}, 11^6 \equiv 4 \pmod{43}$.

If $(y, w) \equiv (1, 0) \pmod{6}$, put $y=6a+1, w=6b$, so we get $5(16)^a \equiv 4+4^b \pmod{43}$, and note that it suffices to check $a, b \pmod{7}$. When $a=0, 1, 2, 3, 4, 5, 6$, we have $$5(16)^a \equiv 5, 37, 33, 12, 20, 19, 3 \pmod{43}$$ When $b=0, 1, 2, 3, 4, 5, 6$, we have $$4+4^b \equiv 5, 8, 20, 25, 2, 39, 15 \pmod{43}$$ Therefore $(a, b) \equiv (0, 0), (4, 2) \pmod{7}$, so $(y, w) \equiv (1, 0), (25, 12) \pmod{42}$.

If $(y, w) \equiv (3, 2) \pmod{6}$, put $y=6c+3, w=6d+2$, so we get $125(16)^c \equiv 4+121(4)^b \pmod{43}$, and note that it suffices to check $c, d \pmod{7}$. When $c=0, 1, 2, 3, 4, 5, 6$, we have $$125(16)^c \equiv 39, 22, 8, 42, 27, 2, 32 \pmod{43}$$ When $d=0, 1, 2, 3, 4, 5, 6$, we have $$4+121(4)^d \equiv 39, 15, 5, 8, 20, 25, 2 \pmod{43}$$ Therefore $(c, d) \equiv (0, 0), (2, 3), (5, 6) \pmod{7}$, so $(y, w) \equiv (3, 2), (15, 20), (33, 38) \pmod{42}$.

Combining gives $$(y, w) \equiv (1, 0), (3, 2), (15, 20), (25, 12), (33, 38) \pmod{42}$$

Let us first consider $z \geq 2$. Then $\pmod{49}$ gives $3+5^y \equiv 11^w \pmod{49}$. We shall get a contradiction. It suffices to check the above pairs, since $\varphi(49)=42$.

\begin{align}
3+5^1-11^0 \equiv 7 \pmod{49} \\
3+5^3-11^2 \equiv 7 \pmod{49} \\
3+5^{15}-11^{20} \equiv 35 \pmod{49} \\
3+5^{25}-11^{12} \equiv 35 \pmod{49} \\
3+5^{33}-11^{38} \equiv 21 \pmod{49}
\end{align}

Since none of the above pairs give $0 \pmod{49}$, we get a contradiction.

Therefore $z=1$, and we now have the equation $3+5^y=7+11^w$, or after simplification, $$5^y=4+11^w$$

Recall that we have $(y, w) \equiv (1, 0), (3, 2) \pmod{4}$ and $(y, w) \equiv (1, 0), (3, 2) \pmod{6}$.

If $y=1$, we immediately have $11^w=1$ so $w=0$. This gives the solution $(x, y, z, w)=(1, 1, 1, 0)$.

Otherwise $y \geq 2$. Taking $\pmod{25}$, $11^w \equiv 21 \pmod{25}$, so $w \equiv 2 \pmod{5}$. This implies that $w \geq 2$.

Taking $\pmod{11}$, we have $5^y \equiv 4 \pmod{11}$, so $y \equiv 3 \pmod{5}$. Therefore $y \geq 3$.

If $(y, w) \equiv (1, 0) \pmod{6}$, then $(y, w) \equiv (13, 12) \pmod{30}$. Then taking $\pmod{31}$, $5 \equiv 5^{13} \equiv 5^y \equiv 4+11^w \equiv 4+11^{12} \equiv 20 \pmod{31}$, a contradiction. Therefore $(y, w) \equiv (3, 2) \pmod{6}$, so $(y, w) \equiv (3, 2) \pmod{30}$.

If $(y, w) \equiv (1, 0) \pmod{4}$, then $(y, w) \equiv (33, 32) \pmod{60}$. Then taking $\pmod{61}$, we get $3 \equiv 5^{33} \equiv 5^y \equiv 4+11^w \equiv 4+11^{32} \equiv 5 \pmod{61}$, a contradiction. Therefore $(y, w) \equiv (3, 2) \pmod{4}$, so $(y, w) \equiv (3, 2) \pmod{60}$.

Now taking $\pmod{125}$, we get $11^w \equiv 121 \pmod{125}$, so $w \equiv 2 \pmod{25}$, so $w \equiv 2 \pmod{300}$. Taking $\pmod{101}$, we get $5^y \equiv 4+11^w \equiv 4+11^2 \equiv 125 \pmod{101}$, so $y \equiv 3 \pmod{25}$, so $y \equiv 3 \pmod{300}$.

Here comes the last part. If $y=3$, then clearly $11^w=121$ implies $w=2$, giving us the solution $(x, y, z, w)=(1, 3, 1, 2)$.

Otherwise $y \geq 4$. Taking $\pmod{625}$, we get $11^w \equiv 621 \pmod{625}$. This implies that $w \equiv 52 \pmod{125}$, so $w \equiv 52 \pmod{250}$.

Finally we take $\pmod{251}$, and we shall get a contradiction. We have $5^y \equiv 4+11^w \equiv 4+11^{52} \equiv 148 \pmod{251}$. Note that $5^{25} \equiv 1 \pmod{251}$, so $5^y \equiv 5^3 \equiv 125 \not \equiv 148 \pmod{251}$, a contradiction.

Therefore, all solutions to the equation $$3^x+5^y=7^z+11^w$$ are given by $(x, y, z, w)=(0, 0, 0, 0), (1, 1, 1, 0), (1, 3, 1, 2)$.

This is just a partial answer/analysis because I feel it is not fitting as a comment.

Edit: Ivan Loh’s excellent answer gives a full resolution.

Let us employ modulo arithmetic to reduce some cases:

Modulo $3$: This assumes $x\ne 0$: $0^x+(-1)^y \equiv 1^z +(-1)^w \pmod 3$, hence $y$ odd, $w$ even.

Modulo $4$: $(-1)^x + 1 \equiv (-1)^z + 1 \pmod 4$ (since $w$ even), hence $x,z$ have equal parity.

Modulo $5$: This assumes $y \ne 0$: $3^x \equiv 2^z +1 \pmod 5$. We can enumerate all solutions by letting $x$ run. For $x=0$ there is no solution; $x=1, z=1$; $x=2,z=3$; $x=3,z=4$. Because $\Bbb Z_5^\times$ has order $4$, we conclude that $x=z=1 \pmod 4$.

Modulo $7$: This assumes $z \ne 0$: An exhaustive search reveals that modulo $6$, we have the following six options for $(x,y,w)$:

$$(1,1,0) \quad (1,3,2) \quad (3,1,4) \quad (3,5,2) \quad (5,3,4)\quad (5,5,0)$$

In particular, we have $z \ne 0$ implies $y \ne 0$, which in turn implies $x \ne 0$, which by the modulo 4 case is equivalent to $z \ne 0$. Thus if $x = 0$, also $y=z=0$ and we miss only the trivial solution $(x,y,z,w)=(0,0,0,0)$ by assuming $x,y,z$ nonzero.