<s>[INST] Given $a_1,a_{100}, a_i=a_{i-1}a_{i+1}$, what's $a_1+a_2$? I've been given the following puzzle

Let $a_1, a_{100}$ be given real numbers. Let $a_i=a_{i-1}a_{i+1}$ for $2\leq i \leq 99$. Further suppose that the product of the first $50$ is $27$, and the product of all the $100$ numbers is also $27$.
Find $a_1+a_2$.

I tried the following, looking at the sequence for a moment we see:
$$
a_2=a_1\, a_3\\
a_3=a_2\,a_4\\
\vdots\\
a_{99}=a_{98}\,a_{100}
$$
So $$a_2=\frac 1 {a_{99}} \prod_i a_i =\frac {27}{a_{99}}$$
Looking at the other elements, we find that $$a_3=\frac {a_2} {a_1}, a_4=\frac {a_2}{a_1 a_2}, a_5=\frac {a_2}{a_1a_2a_3},\dots , a_n=\frac {a_2}{\prod_{i=1}^{n-2} a_i}$$
Then, $$27=\prod_i a_i=\prod_{1\leq i\leq 100} \frac {a_2}{\prod_{k=1}^{i-1}a_i}$$
The last product I believe is much more complicated than what I should have gotten... 
Has anyone ran into this puzzle before?
 [/INST] Note that since $a_i=a_{i-1}a_{i+1}$, then, for $i\geqslant 3$, we also have $a_{i-1}=a_{i-2}a_i$. Plug this in the first formula, we have $a_i=a_{i-2}a_ia_{i+1}\Rightarrow a_{i-2}a_{i+1}=1\Rightarrow a_{i+3}=\frac{1}{a_i}.$
Then, the sequence is in the form of $a_1=a,a_2=ab,a_3=b,a_4=\frac{1}{a},a_5=\frac{1}{ab},a_6=\frac{1}{b},a_7=a,\dots$.
$a_{i+6}=a_i$. So $a_{50}=ab$ and $a_{100}=\frac{1}{a}$. Hence, $1=\prod_{i=51}^{100}=\frac{b}{a}\Rightarrow a=b$. Also, $27=\prod_{i=1}^{50}=a\cdot (ab)=a^3\Rightarrow a=3\Rightarrow a_1+a_2=3+9=12$.
</s>