In the city of records and curiosities, they built a pyramid from cubes. In the top layer, there is one cube, and the number of cubes in each layer increases by two as you move downward (the top layers of the structure are shown in the image).

![](https://cdn.mathpix.com/cropped/2024_04_17_7dc1166ff4d250faa543g-3.jpg?height=340&width=554&top_left_y=1029&top_left_x=751)

The first, i.e., the bottom layer, is black, the second is gray, the third is white, the fourth is black again, the fifth is gray, the sixth is white, and the colors alternate regularly up to the top layer.

Determine how many layers the pyramid has, given that 55 more black cubes were used than white ones.

(L. Simünek)
In the first three layers counted from the bottom, the number of black cubes is 4 greater than the number of white cubes. This statement also applies to each subsequent triplet of layers with black cubes at the bottom. The problem does not specify:

a) whether the structure can be divided into such triplets without a remainder,

b) whether there is one more layer above the top triplet, and it is black,

c) whether there are two more layers above the top triplet, one black and one gray.

In case a), the difference between the number of black and white cubes must be a multiple of four. In case b), this difference must be a multiple of four increased by one, and in case c), it must be a multiple of four increased by three.

If we divide the given difference of 55 by 4, we get 13 with a remainder of 3. From this, we see that of the given options, c) is valid. The pyramid has a total of \(13 \cdot 3 + 2 = 41\) layers.

Another solution. We will divide the solution into three parts. In part a), we will assume that the top layer is white, in part b), that the top layer is black, and in part c), that the top layer is gray. In each part of the solution, we will gradually add increasing layers to the table. The problem states that the largest layer is black, so for each black layer, we will record the difference between the number of black and white cubes in the layers recorded so far. We will stop filling in the table when this difference is equal to 55 or greater.

a) Top cube is white:

| layer from top | 1 | 2 | 3 | 4 | 5 | 6 | $\ldots \ldots$ | 37 | 38 | 39 | 40 | 41 | 42 |
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| cubes in layer | 1 | 3 | 5 | 7 | 9 | 11 | $\ldots \ldots$ | 73 | 75 | 77 | 79 | 81 | 83 |
| color | w | g | b | w | g | b | $\ldots \ldots$ | w | g | b | w | g | b |
| difference |  |  |  |  | 8 | $\ldots \ldots$ |  |  | 52 |  |  | 56 |  |

b) Top cube is black:

| layer from top | 1 | 2 | 3 | 4 | 5 | 6 | 7 |  | 38 | 39 | 40 | 41 | 42 | 43 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| cubes in layer | 1 | 3 | 5 | 7 | 9 | 11 | 13 |  | 75 | 77 | 79 | 81 | 83 | 85 |
| color | b | w | g | b | w | g | b |  | w | g | b | w | g | b |
| difference | 1 |  |  | 5 |  |  | 9 |  |  |  | 53 |  |  | 57 |

c) Top cube is gray:

| layer from top | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | . | 36 | 37 | 38 | 39 | 40 | 41 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| cubes in layer | 1 | 3 | 5 | 7 | 9 | 11 | 13 | 15 | . . | 71 | 73 | 75 | 77 | 79 | 81 |
| color | g | b | w | g | b | w | g | b |  | w | g | b | w | g | b |
| difference |  | 3 |  |  | 7 |  |  | 11 |  |  |  | 51 |  |  | 55 |

We reached the difference of 55 only in table c), according to which the structure has 41 layers.

Evaluation. 2 + 2 points for excluding options a) and b); 2 points for the correct number of layers.