Show that there is a unique sequence of positive integers $(a_n)$ satisfying the following conditions.
$$a_1=1,a_2=2,a_4=12,a_{n+1}a_{n-1}=a_n^2\pm 1$$
I approached the problem to find out,
$a_3=4 \pm 1$
$a_2a_4=a_3^2\pm1 \implies 24\mp1=a_3^2 \implies a_3=5$ as $a_n \in \mathbb{N}$
I could not do anything more. Even, I could not understand what should I show to prove that the sequence is unique. Please help.
Hint: For uniqueness, let $a_n$ and $b_n$ be two different sequences which satisfy the conditions. Suppose the first point at which they differ is $n+1$ - you know $n$ is at least $3$ because the sequences agree up to the fourth term. Then follow through the implications of that. It is useful to prove existence first because you may need to know something about the size of the terms.
Hint: for existence the sequence $1,2,5,12 \dots$ satisfies a simple linear recurrence relation, which can be used to show by induction that there is always a next term, and can be used to determine the general term.
The sequence is well known in other contexts - Pell's equation and continued fractions - where it is paired with $1,3,7,17 \dots$