# 6. CONDITION

Vasya has three cans of paint of different colors. In how many different ways can he paint a fence consisting of 10 planks so that any two adjacent planks are of different colors and he uses all three colors of paint? Justify your answer.
Solution. Let's calculate the number of ways to paint the fence so that any 2 adjacent boards are painted in different colors. The first board can be painted with any of the three colors, the second with one of the two remaining colors. The third board can be painted with one of the two colors that differ from the color of the second board, and so on. Thus, the number of ways is $3 \cdot 2^{9}=1536$. The obtained number includes the ways to paint the fence using only 2 colors. The number of such ways is 6 (the first board can be painted in three ways, the second in two, and the rest are uniquely determined). Therefore, $1536-6=1530$ ways.

Answer. 1530.