# solve: how many arrangements of six 0's, 5's and 4's are r\there in which a) the first 0 preceeds the first 1 b) the first 0 preceeds the first 1 which preceeds the first 2?

*print*Print*list*Cite

I'm guessing you meant six 0s, six 1s, six 2s? otherwise there are no such arrangements, since an arrangement of 0s, 4s,and 5s contains no 1s.

A) take any such arrangement, and ignore the 2s for a moment. This is an arrangement of six 0s and six 1s. We can think of this as filling up the following with 0s and 1s:

------------

The first one can't be a 1, else the first 1 would appear before the first 0. Thus we have:

0-----------

Of the eleven spots that remain, we must choose five of them to contain 0s. The rest we fill in with 1s. There are `([11],[5])=462`

ways to do this.

Say we happen to pick:

001011001011

Now, we want to fill in:

------------------

with six 0s, six 1s, six 2s. We can do this by picking the six spots that will go to 2s. There are `([18],[6])=18564` ways to do this. And then filling in the remaining spots with our number. E.g., suppose we had picked:

--222--2-----2---2

Then our number would be:

002221021100120112

So we have 462*18564=8576568 ways to do this.

B)

We use the same logic as before:

Take any arrangement of the numbers. Ignore the 0s, and what remains is an arrangement of 1s and 2s. Thus we want to fill the slots of:

------------

with 1s and 2s. But we want the first 1 to appear before the first 2, so we must have:

1-----------

In the remaining eleven spots go five 1s and six 2s. We choose the spots for the 1s. There are `([11],[5])=462` ways to do this. And then fill the remaining spots with the 2s.

We end up with a string, say 111221221212

Now, we want to fill in:

------------------

with six 0s, and then fill in the remaining spots in order, using the numbers from our string containing 1s and 2s. But we want the first spot to go to a 0. Thus:

0-----------------

There are seventeen spots remaining, and five of them must be 0. There are `([17],[5])=6188` ways to pick the 0 spots. Say we pick:

0---0----00-----00

We then fill in the remaining spots using, in order, our arrangement of 1s and 2s:

011102212002121200

Thus there are 462*6188=2858856 possible arrangements.