TITLE: Prove that for all $n$ $\gcd(n, x_n)=1$, given $x_{n+1}=2(x_n)^2-1$ and $x_1=2$
QUESTION [6 upvotes]: I have a sequence $x_{n+1} = 2(x_n)^2-1$; first values are $2, 7, 97, 18817,\dots$
I noticed that if prime $p$ divides $x_n$, then $x_{n+1} \equiv -1\pmod p$ and for all $k>n+1$, $x_k\equiv 1\pmod p$. But I have no idea what to do next.

REPLY [2 votes]: We can write
$$x_n=\frac{1}{2}\left[\tau^{2^{n-1}}+\tau^{-2^{n-1}}\right]$$
where $\tau=2+\sqrt{3}$. Now, given an odd prime $p$, $p|x_n$ if and only if
$$\tau^{2^{n-1}}+\tau^{-2^{n-1}}=0$$
(where we work in $\mathbb{F}_{p^2}$). This reduces to
$$\tau^{2^n}= -1.$$
Let $k$ be the multiplicative order of $\tau$ (the smallest positive integer so $\tau^k=1$). Then we have
$$\tau^{2^{n+1}}=1,\tau^k=1\implies \tau^{\gcd\left(2^{n+1},k\right)}=1,$$
which implies $k|2^{n+1}$ as $k$ is minimal. However, if $k=2^m$ with $m\leq n$ then
$$-1=\tau^{2^n}=\left(\tau^{2^m}\right)^{2^{n-m}}=1^{2^{n-m}}=1,$$
a contradiction, so $k=2^{n+1}$. A result of this is that $2^{n+1}$ divides the order of $\mathbb{F}_{p^2}^{\times}$, which is $p^2-1$; this implies that $2^n$ divides $p\pm 1$; in particular,
$$p\geq 2^n-1>n$$
(where the second condition holds if $n>1$). Only $p=2$ divides $x_n=1$, and if $p=2$, then $p|x_n$ iff $n=1$. So, any prime $p$ that divides $x_n$ is greater than $n$, which finishes our proof.