4. Determine all triples $(a, b, c)$ of positive integers such that

$$
a^{2}+2^{b+1}=3^{c} .
$$
Solution: Suppose that $(a, b, c)$ is a solution to the given equation. First, observe that $2^{b+1}$ is even and $3^{c}$ is odd, so $a$ must be odd. Let $a=2 k+1$.

The assumption $b \geq 1$ implies that $4 \mid 3^{c}-a^{2}=3^{c}-4 k(k+1)-1$, so $4 \mid 3^{c}-1$. Observing that $3^{c}-1=(3-1)\left(3^{c-1}+\right.$ $\left.3^{c-2}+\cdots+3+1\right)$, we see that $3^{c}-1$ is a multiple of 4 only if $m=3^{c-1}+3^{c-2}+\cdots+3+1$ is even. Since $m$ is the sum of $c$ odd numbers, $c$ must be even.

We can thus set $c=2 c^{\prime}$, where $c^{\prime}$ is a positive integer. Subtracting $a^{2}$ from both sides, our equation becomes

![](https://cdn.mathpix.com/cropped/2024_04_17_eced7b5697d18dade9f8g-2.jpg?height=140&width=1881&top_left_y=2304&top_left_x=106)
both are odd, so their sum and difference are even, meaning both $x$ and $y$ are positive. Since $a$ is positive, we also have $x>y$, and thus $x \geq 2$.

Adding the first two equations of the system and dividing by 2, we get $3^{c^{\prime}}=2^{x-1}+2^{y-1}$. But $3^{c^{\prime}}$ is odd and $2^{x-1}$ is even, so $2^{y-1}$ is odd and thus $y=1$. From the third equation of the system, we get $x=b$ and therefore, substituting,

$$
3^{c^{\prime}}=2^{b-1}+1
$$

By direct verification, this last equation has no solution if $b=1$; if $b=2$, however, there is the solution $c^{\prime}=1$, i.e., $c=2$: substituting back into the initial equation, we find $a=1$ and thus we obtain the solution $(a, b, c)=(1,2,2)$ (it is verified that indeed $1^{2}+2^{2+1}=3^{2}$ ).

Now suppose $b \geq 3$. We have $4 \mid 3^{c^{\prime}}-1$ and, with the same proof as before, we get $c^{\prime}=2 c^{\prime \prime}$ and the system

$$
\left\{\begin{array}{l}
3^{c^{\prime \prime}}+1=2^{x^{\prime}} \\
3^{c^{\prime \prime}}-1=2^{y^{\prime}} \\
x^{\prime}+y^{\prime}=b-1
\end{array}\right.
$$

Similarly to before, we get that $y^{\prime}=1$, from which $c^{\prime \prime}=1$ (i.e., $c=4$), $x^{\prime}=2$ and $b=4$. Substituting back into the initial equation, we find $a=7$, and thus the solution $(a, b, c)=(7,4,4)$ (it is verified that indeed $7^{2}+2^{4+1}=$ $3^{4}$ ).

Therefore, the only solutions are $(1,2,2)$ and $(7,4,4)$.