# Thread: combinatorics- r-digit ternary sequences

1. ## combinatorics- r-digit ternary sequences

Hi, I have found some examples online of ternary sequences but still don't understand how to do

how many r-digit ternary sequences are there with:
a) and even # of 0s?
b) and even # of 0s and even # of 1s?
c) at least one 0 and at least one 1?

thanks for any help

2. Originally Posted by dixie
how many r-digit ternary sequences are there with:
a) and even # of 0s?
b) and even # of 0s and even # of 1s?
c) at least one 0 and at least one 1?
I understand that the reply is really late but I was stopped by part (b).
The other two parts have rather simple solutions.
But I found no simple way to model part (b).
(a) $\displaystyle \sum\limits_{k = 0}^{\left\lfloor {\frac{r}{2}} \right\rfloor } {\left( {\begin{array}{c} r \\ {2k} \\ \end{array} } \right)} \left( {2^{r - 2k} } \right)$.

(b) $\displaystyle \sum\limits_{k = 0}^{\left\lfloor {\frac{r}{2}} \right\rfloor } {\sum\limits_{j = 0}^{\left\lfloor {\frac{r}{2}} \right\rfloor - 2k} {\left( {\begin{array}{c} r \\ {2k} \\ \end{array} } \right)\left( {\begin{array}{c} {r - 2k} \\ {2j} \\ \end{array} } \right)} }$

This beautifully simple.
(c) $\displaystyle 3^r - 2^{r + 1} + 1$.

3. If the previous reply was late then this one is really, really late, but I can't resist applying some exponential generating functions to these problems. I don't know Dixie's background, so he/she may not be able to follow the generating functions, but maybe the final answers will be useful anyway. In what follows, $\displaystyle a_r$ is the number of r-digit ternary sequences and $\displaystyle f(x) = \sum_{r=0}^\infty \frac{a_r}{ r!} x^r$ is the associated exponential generating function.

a) $\displaystyle f(x) = (e^x + e^{-x}) \, e^{2x} / 2$
$\displaystyle a_r = (3^r + 1) /2$

b) $\displaystyle f(x) = [(e^x + e^{-x}) / 2]^2 \, e^x$
$\displaystyle a_r = (3^r + 2 + (-1)^r) / 4$

c) $\displaystyle f(x) = (e^x - 1)^2 \, e^x$
$\displaystyle a_r = 3^r - 2^{r+1} + 1$

I haven't attempted to figure out if the answers to a) and b) are actually different than Plato's answers, or simply the same answers written in a different form.