The worm consists of a white head and several segments, see the image.

![](https://cdn.mathpix.com/cropped/2024_04_17_617ae705de5106651eccg-2.jpg?height=149&width=397&top_left_y=2033&top_left_x=835)

When the worm is born, it has a head and one white segment. Each day, the worm gains a new segment in one of the following ways:

- either a white segment splits into a white and a gray segment:

![](https://cdn.mathpix.com/cropped/2024_04_17_617ae705de5106651eccg-2.jpg?height=100&width=322&top_left_y=2389&top_left_x=867)

- or a gray segment splits into a gray and a white segment:

![](https://cdn.mathpix.com/cropped/2024_04_17_617ae705de5106651eccg-3.jpg?height=97&width=322&top_left_y=303&top_left_x=867)

(In both cases, we describe the situation when looking at the worm from the head.) On the fourth day, the worm matures and stops growing - its body consists of a head and four segments.

How many different color variants of mature worms of this species can exist?

(E. Novotná)

Hint. What can a two-day-old worm look like?
On the first day of its life, a worm has only one white segment (and a head):

![](https://cdn.mathpix.com/cropped/2024_04_17_617ae705de5106651eccg-3.jpg?height=137&width=186&top_left_y=805&top_left_x=935)

On the second day, it can grow a new segment only in the first of the mentioned ways; all worms that are two days old therefore look the same:

![](https://cdn.mathpix.com/cropped/2024_04_17_617ae705de5106651eccg-3.jpg?height=143&width=240&top_left_y=1136&top_left_x=908)

On the third day, either the first (white) or the second (gray) segment can split, so there are two possibilities:
![](https://cdn.mathpix.com/cropped/2024_04_17_617ae705de5106651eccg-3.jpg?height=142&width=820&top_left_y=1458&top_left_x=616)

On the fourth day, any of the three segments of both types of worms from the previous day can split, so we need to check a total of six possibilities:
![](https://cdn.mathpix.com/cropped/2024_04_17_617ae705de5106651eccg-3.jpg?height=430&width=882&top_left_y=1782&top_left_x=584)

By comparing all six adult worms, we find that there are two pairs of identical worms, and the remaining two are different from all others. Therefore, there are exactly four different color variants of adult worms of this interesting species.

#