4. Solve the equation

$$
1+x+x^{2}+x^{3}=2^{y}
$$

in the set of integers.
Solution. Let's write the given equation in the form

$$
(1+x)\left(1+x^{2}\right)=2^{y}
$$

From here it follows that $x+1=2^{m}, x^{2}+1=2^{y-m}$, i.e.

$$
\begin{gathered}
x=2^{m}-1 \quad \text { and } \quad x^{2}=2^{y-m}-1 \\
x^{2}=2^{2 m}-2^{m+1}+1 \\
2^{y-m}+2^{m+1}-2^{2 m}=2
\end{gathered}
$$

There are two possible cases:

(i) Let $m=0$, then the only solution is $x=y=0$

(ii) Let $m>0$. Then we get $2^{y-m-1}+2^{m}-2^{2 m-1}=1$. Since $2^{m}$ and $2^{2 m-1}$ are even numbers, it follows that $2^{y-m-1}$ is an odd number, which is possible if and only if $2^{y-m-1}=1$, i.e. $y=m+1$. Substituting this, we get

$$
2^{m}=2^{2 m-1}
$$

from which it follows that $m=1, y=2$ and $x=1$.

Thus, the only solution in this case is $x=1$ and $y=2$.