Number of ternary sequences ${0,1,2}$ of length n without two consecutive even numbers.

390 Views Asked by At

(I edited the question and erased my last try, cause my understanding of it, was poor)

any help would be appreciated.

2

There are 2 best solutions below

0
On BEST ANSWER

As @Element118 says above, the recurrence will be $a_n=a_{n-1}+2a_{n-2}$ with initial conditions $a_0=1$ and $a_1=3$.

It is worth going through the effort to find the closed form as well, as this is where the difficulty usually comes into play.

We find our characteristic polynomial is $x^2-x-2=0=(x-2)(x+1)$

Our equation should then look something like $a_n=c_1(2)^n+c_2(-1)^n$ for some appropriate numbers $c_1$ and $c_2$.

Using our initial conditions, we have the following system of equations:

$\begin{cases}1=c_1+c_2\\3=2c_1-c_2\end{cases}$

Solving gives $c_1=\frac{4}{3}$ and $c_2=-\frac{1}{3}$ for a final answer of

$$a_n = \frac{4}{3}(2)^n-\frac{1}{3}(-1)^n$$

0
On

Your previous method of solving this still stands. If $a_n$ is the number of sequences of length $n$, we can break it down into cases:

If you start with $0$ or $2$, the next number has to be $1$, this case has $2a_{n-2}$ ways.

Otherwise, you start with $1$, this case has $a_{n-1}$ ways.

The base cases would be $a_0=1$ and $a_1=3$.