Start with a positive integer, then choose a negative integer. We’ll use these two numbers to generate a sequence using the following rule: create the next term in the sequence by adding the previous two. If we started with 3 and −2, we would get the sequence:
3, −2, 1, −1, 0, −1, −1, −2, −3, . . .
which starts with 4 elements that alternate sign before the terms are all non-positive (we don’t count 0 in the alternating part). (a) Can you find a sequence with any number of elements that alternate sign? (b) Given a particular starting integer, what negative number should you choose to make the alternating part of the sequence as long as possible? For example, if your sequence started with 8, what negative number would give the longest alternating part? With n? I think it's got something to do with the Fibonacci Sequence.
Any help?
Define $\langle a_n \rangle_{n \in \mathbb{N}}$ as the sequence with $a_1 = a$ and $a_2 = b$ which satisfies $a_{n+2} = a_{n+1} + a_n \ \ \forall n \in \mathbb{N}$ and $a>0$ is fixed.
Claim: $$a_n = \frac{b-a\psi}{1+\phi^2}\cdot\phi^n + \frac{ b-a\phi}{1+\psi^2}\cdot \psi^n$$ for all natural $n$.
To prove this, consider the characteristic equation of the sequence $a_n$ which is $x^2 - x - 1 = (x-\phi)(x-\psi) = 0$ with $\phi > \psi$. Therefore, we can write $a_n = A\phi^n + B\psi^n$. Putting $n=1$ gives $A\phi+B\psi = a$ and putting $n=2$ gives $A\phi^2 + B\psi^2 = b$. Solving the system of these two equations for $A$ and $B$ gives the claim.
Claim: The sequence $a_n\to \pm \infty$ as $n\to\infty $ if the sequence terminates alternation at some $a_i$.
Suppose the sequence alternates from $a_1$ to $a_i$ with $i \geq 1$. Then $a_{i+1}$ has the same sign as $a_i$ (or is $0$) and from $a_{i+2}=a_{i+1}+a_i$ it follows that the sequence monotonically increases or monotonically decreases from $a_{i+2}$ onwards and is unbounded. This gives the claim.
From the first claim note that $$\lim_{n\to\infty} a_n = \text{sgn}(b-a\psi)\infty$$ Both the cases where the limit is $\pm \infty$ are covered by claim $2$. When $b= a\psi$ we have $a_n\to 0$ when $n\to 0$. Thus the terms of the sequence get arbitrarily close to $0$ for large $n$. But since we have $a_{n+2} = a_{n} + a_{n+1}$ it must be that the sequence alternates infinitely. Thus, $b$ should be the closest integer to $a\psi$ to maximise the alternating period of the sequence.
So, the optimal choice for maximising the alternating period length is $$\boxed{b \approx a\psi = a(1-\phi)}$$
NOTE: $b> a\psi$ means the sequence would have positive terms after alternating ends and $b<a\psi$ means the sequence would have negative terms after alternating ends.