3
$\begingroup$

I have a group with the size of n, and only 2 different elements (1 and 0) with k times 1 and m times 0. For example:

1 1 1 0 1 1 1 where n would be 7, k 6 and m 1. I can arrange this group in Binomial[7,6] = Binomial[7,1] = 7 different ways.

1 1 1 0 1 1 1

1 1 0 1 1 1 1

1 0 1 1 1 1 1

0 1 1 1 1 1 1

1 1 1 1 1 1 0

1 1 1 1 1 0 1

1 1 1 1 0 1 1

And I want to know how often I can find the sequence 1 1 1. In this example it's easy. It doesn't matter how I arrange this group, I always find 1 1 1 so the answer is 7.

But how about

1 1 1 0 0 1 1, n=7, k=5, m=2

There are Binomial[7,5] = Binomial[7,2] = 21 ways of arranging this group, but how many times can I find the sequence 1 1 1? Sure I can write all 21 ways of arranging it down, and count it, but that's not what I am looking for. I'm thinking for hours about it, but I don't find out how I calculate it generally for n, k and m.

Regards

  • 0
    Ok, so it's not the same, but if instead of 3 consecutive 1s you are after only 2 consecutive 1s, the formula for "in how many ways can you arrange m 1s in n positions without having two consecutive 1s" is Binomial[n-m, m]. So you will have at least two consecutive ones in Binomial[n,m] - Binomial[n-m,m]. Figuring out how many have two, but not three consecutive 1's is beyond me right now...2012-12-07

2 Answers 2