Define a recursive sequence $\{x_n\}$ as follows $$x_0=2,x_1=3,x_n=\frac{x_{n-1}^2+5}{x_{n-2}}(n\ge2).$$ Prove $x_n$ is a prime if and only if $n=0$ or $n=2^k$ where $k\in \mathbb{N}.$
Note that \begin{align*} x_n+x_{n-2}=\frac{x_{n-1}^2+x_{n-2}^2+5}{x_{n-2}}=\frac{x_{n-1}^2+x_{n-3}x_{n-1}}{x_{n-2}}=x_{n-1}\cdot \frac{x_{n-1}+x_{n-3}}{x_{n-2}}. \end{align*} Hence $$\frac{x_{n}+x_{n-2}}{x_{n-1}}=\frac{x_{n-1}+x_{n-3}}{x_{n-2}}=\cdots=\frac{x_2+x_0}{x_1}=3,$$ which implies $$x_n=3x_{n-1}-x_{n-2}.$$ This is a $2$- order linear recursive sequence with its characteristic equation $x^2-3x+1=0$. One can easily obtain its general term $$x_n=\left(\frac{3-\sqrt{5}}{2}\right)^n+\left(\frac{3+\sqrt{5}}{2}\right)^n.$$ How to go on?