Close form fomula for Narayana's cows sequence

Solution 1:

ADDED next morning: took forever, I finally confirmed that my $A$ satisfies $31A^4 - 22 A^2 + 8A - 1$ which reduces, eventually $$ 31 A^3 - 31 A^2 + 9A - 1 = 0$$ Meanwhile, the dependence is $A = \frac{\alpha^3}{\alpha^3 + 2}$ with $$ \alpha \approx 1.465571231876768026656731225 $$ $$ A \approx 0.6114919919508125184143170109 $$ An intermediate step was confirming that $\alpha^{12}-3\alpha^9 - \alpha^6 + 2 \alpha^3 - 1=0.$ From

$$ x^{12} - 3 x^9 - x^6 + 2 x^3 - 1 = $$ $$ (x+1)(x^2-x+1)(x^3-x^2-1)(x^6+x^5+x^4-2x^3-x^2+1) $$

Then using $\alpha^3 = \frac{2A}{1-A}$ That is, $\delta = \alpha^3$ is a root of $\delta^4 - 3 \delta^3 - \delta^2 + 2 \delta - 1 = (\delta+1)(\delta^3-4\delta^2 + 3 \delta -1) $

ORIGINAL:the set of sequences $x_n$ with $ x_{n+3} - x_{n+2} - x_n = 0$ is a vector space over the complexes. A basis is $$ \alpha^n \; \; , \; \; \beta^n \; \; , \; \; \bar{\beta}^n \; \; , \; \; $$ where $ \alpha \approx 1.465571231876768026656731225 $ and $ \beta \approx -0.2327856159383840133283656126 + 0.7925519925154478483258983007i$

Note that $\beta$ and $\bar{\beta}$ have norm smaller than $1,$ so that $\beta^n$ and $\bar{\beta}^n$ approach $0$ fairly quickly.

I see, you are calling my $\alpha = C$

Any complex series can be written using the basis. If all elements of the sequence are real, the coefficients come out $$ x_n = A \alpha^n + B \beta^n + \bar{B} \bar{\beta}^n $$

Once more, you have my $A = d.$ From the comment about the norms going to zero, we know that ( because your sequence is always integers) $x_n$ really is the closest integer to $A \alpha^n.$ Rounding a positive real $t$ to the nearest integer can be done with $ \left\lfloor t + \frac{1}{2} \right\rfloor $