4. Find all pairs of natural numbers $a$ and $b$ such that $3^{a}+4^{b}$ is a perfect square of an integer.
Answer: $a=b=2$.

Solution. From the equality $3^{a}+4^{b}=n^{2}$, it is clear that the number $n$ is odd, and therefore $n=2 x+1$. Then the original equality can be written as: $3^{a}+4^{b}=(2 x+1)^{2}=4 x^{2}+4 x+1$, from which it follows that the number $3^{a}$ has a remainder of 1 when divided by 4. The latter is only possible if $a$ is even, that is, $a=2 y$ for some natural $y$, and thus,

$$
9^{y}+4^{b}=(2 x+1)^{2} \quad \Longleftrightarrow \quad 2^{2 b}=(2 x+1)^{2}-\left(3^{y}\right)^{2}=\left(2 x+1-3^{y}\right)\left(2 x+1+3^{y}\right)
$$

Both factors on the right side are powers of two, their sum is $2(2 x+1)=4 x+2$, which does not divide by 4, and therefore, exactly one of them does not divide by 4. The only power of two with this property is $2^{1}$, so

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

Subtracting the equations from each other, we get $3^{y}=2^{2 b-2}-1=\left(2^{b-1}-1\right)\left(2^{b-1}+1\right)$. Each of the numbers $2^{b-1}-1$ and $2^{b-1}+1$ is a power of three, and the difference between these numbers is 2. The only pair of such powers is $3^{0}=1$ and $3^{1}$. (For any other powers of three, their difference is greater than 2.) Therefore, $2^{b-1}-1=1$, that is, $b=2$. Then $3^{y}=2^{2 b-2}-1=3, y=1$, hence $a=2 y=2$. In the end, we get $3^{2}+4^{2}=5^{2}$, that is, $n=5$.

Criteria. Only the answer - 1 point. Proved the evenness of the number $a$ - another 1 point. Proved that the factors are powers of two or three - up to 3 points. The criteria are cumulative. Full solution - 7 points.