Consider a sequence $a_i$ defined such thatby
$a_1=p,a_2=q,a_i=a_{i-1} \oplus a_{i-2}+1$$$
\begin{align*}
a_1&=p,\\
a_2&=q,\\
a_i&=a_{i-1} \oplus a_{i-2}+1,
\end{align*}$$
where $\oplus$ is the bitwise xor operation. How tocan we give an upper bound offor $a_n$ as a function of $p,q,n$?
In fact, there
There are lots of $p,q$ which satisfy $\mathop {\lim }\limits_{n \to \infty } {a_n} = \infty $, but I have found by experimetationit seems from experimentation that $a_n=O(n)$. I donnotdo not have any idea how to prove it and neither, nor do I know whether it is correct.
If suchthis problem is difficult to solve, I just only need to prove a specific situation: when $p,q,n \le 1000$that, for each $1 \le i \le n$, we have $a_i \le 2^{12}$ when $p,q,n \le 1000$.