Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

From combinatorics, it's known that over an alphabet of $n$ symbols there are $n^k$ different strings of length $k$, of which $\frac{n!}{(n-k)!}$ (assuming $k \le n$) are those without any repeated symbols.

But how to find how many strings of length $k$ without consecutive symbols repeated?

For example if the alphabet is {A, B, C }, acceptable strings are ABAB and BACA, whereas ABBA or AAAA are not.

share|improve this question

1 Answer 1

up vote 8 down vote accepted

Hint: You have $n$ choices for the first symbol. After that, you always have $n-1$ choices.

share|improve this answer
    
...which means there are $n*(n-1)^{(k-1)}$ possible strings of length $k$ without consecutive symbols repeated over an alphabet of $n$ symbols. –  Claudio Floreani Dec 4 '11 at 20:21
    
@Claudio Floreani: Yes, that's right. I wanted to leave you something to do! –  André Nicolas Dec 4 '11 at 21:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.