Find all perfect squares that can be written as the sum of two powers of 2.
We claim that the squares which work are $4^{k+1}$ or $9 \cdot 4^{k}$ for $k \in \mathbb{Z}_{\geq 0}$. These work because $4^{k+1}=2^{2 k+1}+2^{2 k+1}$ and $9 \cdot 4^{k}=2^{2 k+3}+2^{2 k}$.

Write $n^{2}=2^{a}+2^{b}$ for $n, a, b \in \mathbb{Z}_{\geq 0}$ and $a \geq b$. If $a=b, n^{2}=2^{b+1}$, and since the perfect squares that are powers of two are the powers of 4 , we have $n=4^{k+1}$ for some $k \in \mathbb{Z}_{\geq 0}$.

Otherwise, $a-b>0$ so $2^{a-b}$ is even and $2^{a-b}+1$ is odd. Therefore, $2^{b}$ and $2^{a-b}+1$ are relatively prime, so since $n^{2}=2^{a}+2^{b}=2^{b}\left(2^{a-b}+1\right), 2^{b}$ and $2^{a-b}+1$ are perfect squares, so $2^{b}$ is a power of 4 . Let $m^{2}=2^{a-b}+1$, so $(m-1)(m+1)=2^{a-b}$. Then, $m-1$ and $m+1$ are powers of 2 that differ by 2 . By inspection, we see that $m=3$ so $2^{a-b}+1=9$ and $n^{2}$ is 9 times a power of 4 , as desired.