40. For what values of $n$ is the expression $2^{n}+1$ a non-trivial power of a natural number?
63.40. Only for $n=3$. Indeed, if $2^{n}+1=A^{p}$, then $2^{n}=A^{p}-1=(A-1)\left(A^{p-1}+A^{p-2}+\ldots+A+1\right)$. Then $A^{p-1}+A^{p-2}+\ldots+A+1$ is a power of two, not equal to 1, and since $A$ is odd, and the given sum is even, there is an even number of terms in it. Let $p=2 q$. Then $2^{n}=A^{2 q}-1=$ $=\left(A^{q}-1\right)\left(A^{q}+1\right)$, i.e., both $A^{q}-1$ and $A^{q}+1$ are powers of two, differing by two. Therefore, these are two and four, i.e., $2^{n}=8$.