# Thread:

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).
Here are my answers.
(a) $\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) $\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}<br /> r \\ {2k} \\ \end{array} } \right)\left( {\begin{array}{c} {r - 2k} \\<br /> {2j} \\ \end{array} } \right)} }$

This beautifully simple.
(c) $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, $a_r$ is the number of r-digit ternary sequences and $f(x) = \sum_{r=0}^\infty \frac{a_r}{ r!} x^r$ is the associated exponential generating function.

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

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

c) $f(x) = (e^x - 1)^2 \, e^x$
$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.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 11, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9569618701934814, "perplexity_flag": "middle"}