8. Anna, Bella, and Celine are coloring. There are six pencils of different colors. They distribute the pencils among themselves so that everyone gets at least one pencil.

In how many different ways can they distribute the pencils?
A) 537
B) 540
C) 720
D) 729
E) 1170

## B-questions
A8. B) 540 Choose a fixed order for the pencils. Then we can represent a distribution of the pencils over the girls by a sequence of six times the letter A, B, or C. AABBCA, for example, means that Anna gets the first, second, and sixth pencil, Bella the third and fourth, and Celine the fifth pencil. There are $3^{6}=729$ of these sequences, but not all of these sequences give an allowed distribution, since each girl must receive at least one pencil.

There are three sequences where one girl gets all the pencils: AAAAAA, BBBBBB, and CCCCCC. These do not count. We then look at how many sequences there are where Celine gets no pencils, but Anna and Bella each get at least one pencil. There are $2^{6}$ possibilities for a sequence with only A and B, but we have already seen AAAAAA and BBBBBB. Thus, there are $2^{6}-2=62$ sequences where Anna and Bella each get at least one pencil, but Celine gets none. In the same way, we find that there are 62 sequences where Bella or Anna gets no pencil, but the other two girls each get at least one pencil.

In total, we find that there are $729-3-3 \cdot 62=540$ ways to distribute the pencils.