1
$\begingroup$

A friend just asked me how to do the following exercise:

Calculate the amount of 25 bit arrangements that have exactly 15 $1$s and at least two of consecutive $0$s

I want to know if my approach is correct:

Counting disjoint cases is too much of a chore, so I decided to approach this by complement (counting the arrangements that have no consecutive zeroes)

So if I write the "word" $11110010101010101$... and replace the $1$s with $|$ and the $0$s with $*$, I get an arrangement of $15$ bars and $10$ stars. If I think of this as counting the ways of getting balls into containers, this is one possible permutation of the question how to distribute $10$ undistinguishable balls between $16$ distinguishable containers

Looking even further, two zeroes are consecutive is equivalent to saying a container has two balls. So I'm looking at the solutions of the equation

$$a_1 + a_2+ \dots + a_{16}= 10 \ \ , \text {where $a_i$} =1 \lor a_i =0$$

This is equivalent to choosing $10$ out of the 16 containers where I'll put exactly one ball, and leave the rest empty

So the amount of ways to make such an arrangement with no consecutive zeroes is ${16 \choose 10}$

Does what I did make sense?

Edit: Edited because for some reason my brain decided that $25-15 = 8$

$\endgroup$

1 Answer 1

1
$\begingroup$

Yes, that sounds exactly right.

  1. You have a list of fifteen ones. $$111111111111111$$
  2. There are sixteen spaces between and around them: $$\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,1\,\_\,$$
  3. You can pick ten of the spaces to contain exactly one zero. Each such way of doing that will produce a different 25-bit string with 15 ones and no two consecutive zeroes, and all such strings can be produced in this way.

    So the number of 25 bit strings containing fifteen ones and no two consecutive zeroes is:

    $$16 \choose 10$$

  4. Incidentally, to answer your original question, there are ${25 \choose 15}$ bit strings with 15 ones in them, so if we exclude the bitstrings with no consecutive zeroes, we find that there are:

    $${25 \choose 15} - {16 \choose 10} = 3 \,260\,752$$ 25-bit strings with 15 ones and at least one pair of consecutive zeroes.

$\endgroup$
1
  • $\begingroup$ Huh, so it actually was much easier to think. Thanks! $\endgroup$ Commented Dec 13, 2017 at 2:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .