2940875

2946602 Find a recursive definition of this sequence

Here is a rewriting of above work using automaton and generating functions. The associated grammars need to be unambiguous; if not, because of the copies, the numbers obtained will be higher than the right ones.

By the second diagram, one may write

$A = x + xC + xD$ where :

$A = a_1x + a_2x^2 + a_3x^3 + ... $is the generating function (or the string index) for words that ends exactly in $0$. We have similar expressions for B, C and D.

Similarly, the other three equations are:

$B = x^3 + xB + x^3C + x^3D $

$C = x + xA + xB$

$D = x^4 + x^4A + x^4B + xD$

Here $x$ stands for $0$ or $1$, $x^3$ covers the bit string $000$; $x^4$ covers the bit string $1111$;

The above (second) system easily solves to the same solution as the first diagram :

here (for example), $x + {x^3 \over 1-x } $ encodes the set { 0, 000, 0000, 00000, ....}

the two equations are

$ A+B = {x-x^2+x^3 \over 1-x } ( C + D + 1 ) $ and

$ C+D = {x-x^2+x^4 \over 1-x } ( A + B + 1 ) $ that easily solves to $ W=A+B+C+D= {2x - 2x^2 - x^3 + 4x^4 -x^5 -2x^6 + 2x^7 \over 1 - 2x + 2x^3 - 2x^4 + x^6 - x^7} $

$= 2+2x +3x^2 +6x^3 +11x^4 +18x^5+30x^6 +50x^7 +85x^8 +143x^9+ 241x^{10} + ...$

The denominator encodes the required recurrence.