B1. Find all integers $a$ for which $\log _{2}\left(a^{2}-4 a-1\right)$ is also an integer.
B1. Let $\log _{2}\left(a^{2}-4 a-1\right)=n$, where $n$ is an integer. Then $a^{2}-4 a-1=2^{n}$ or $a^{2}-4 a-\left(1+2^{n}\right)=0$. This is a quadratic equation for $a$, which has solutions $a_{1}=2+\sqrt{5+2^{n}}$ and $a_{2}=$ $2-\sqrt{5+2^{n}}$. The equation has an integer solution only if $\sqrt{5+2^{n}}$ is an integer. Let $\sqrt{5+2^{n}}=k$ or $5+2^{n}=k^{2}$ and consider three cases based on the sign of the number $n$. If $n<0$, the number $5+2^{n}$ is odd, so $k$ must also be an odd number. Write $k=2 m-1$, where $m$ is an integer. The equation $5+2^{n}=(2 m-1)^{2}$ can be rearranged to $m(m-1)=2^{n-2}+1$. We observe that $m(m-1)$ is an even integer, so $2^{n-2}+1$ must also be even. For $n=1$, the number $2^{n-2}+1$ is not an integer, and for $n>2$ it is not even. This leaves us with the only possibility $n=2$. In this case, $a_{1}=5$ and $a_{2}=-1$. The only solutions to the problem are therefore $a=-1$ and $a=5$. In both cases, $\log _{2}\left(a^{2}-4 a-1\right)=2$.

2. Another way. Let $\log _{2}\left(a^{2}-4 a-1\right)=n$, where $n$ is an integer. Then $a^{2}-4 a-1=2^{n}$. Since the left side of the equation is an integer, the right side must also be an integer, so $n \geq 0$. If $n=0$, we get $a^{2}-4 a-2=0$. This equation has no integer solutions, as its discriminant $D=16+8=24$ is not a perfect square. Therefore, $n \geq 1$, which means $2^{n}$ is an even number. From the equation $a^{2}-4 a-1=2^{n}$, it follows that $a$ must be an odd number. Write $a=2 k+1$, where $k$ is an integer. If we substitute this into the last equation and simplify, we get $k^{2}-k-1=2^{n-2}$. Since $k^{2}-k=k(k-1)$ is an even number, the left side of the equation is odd, so the right side must also be odd. This means $n=2$ and thus $k^{2}-k-2=0$. The latter equation has solutions $k=2$ and $k=-1$. In the first case, $a=5$, and in the second, $a=-1$.
3. Another way
Writing $a^{2}-4 a-1=2^{n}$ ..... 1 point
Writing the form of $a_{1}$ and $a_{2}$ and concluding that $\sqrt{5+2^{n}}$ is an integer ..... 1 point
Handling cases for $n \leq 0$ ..... 1 point
Justified conclusion that $5+2^{n}=k$ is odd and using this as $k=2 m-1$ ..... 1 point
Rearranging the equation $5+2^{n}=(2 m-1)^{2}$ ..... 1 point
Observation that $2^{n-2}+1$ must be even ..... 1 point
Conclusion with solutions $a_{1}=5$ and $a_{2}=-1$ ..... 1 point
4. Another way (variant)
Writing $a^{2}-4 a-1=2^{n}$ ..... 1 point
Writing the form of $a_{1}$ and $a_{2}$ and concluding that $\sqrt{5+2^{n}}$ is an integer ..... 1 point
Factorization to $4+2^{n}=(k-1)(k+1)$ ..... 1 point
Handling cases for $n \leq 0$ ..... 1 point
Verification for $n \in\{1,2\}$ ..... 1 point
Justified reasoning for $n \geq 3$ ..... 1 point
Conclusion with solutions $a_{1}=5$ and $a_{2}=-1$ ..... 1 point
5. Another way
Writing $a^{2}-4 a-1=2^{n}$ ..... 1 point
Justified conclusion that there are no solutions for $n \leq 0$ ..... 1 point
Justified conclusion that $a$ must be an odd number ..... 1 point
Using the oddness to get $k^{2}-k-1=2^{n-2}$ ..... 1 point
Conclusion that the left side is odd and thus the right side must also be odd ..... 1 point
Conclusion that this holds only for $n=2$ ..... 1 point
Conclusion with solutions $a_{1}=5$ and $a_{2}=-1$ ..... 1 point