In the image, two rows of hexagonal fields are indicated, which continue to the right without limit. Fill in each field with one positive integer so that the product of the numbers in any three adjacent fields is 2018.

Determine the number that will be in the 2019th field in the upper row.

(L. Růžičková)

![](https://cdn.mathpix.com/cropped/2024_04_17_e836f4ee23919875e85ag-2.jpg?height=185&width=439&top_left_y=1278&top_left_x=817)

Hint. Which numbers can you fill in?
The prime factorization of the number 2018 is $2 \cdot 1009$. Therefore, the number 2018 can be expressed as the product of three positive numbers in only two ways (up to the permutation of the factors):

$$
1 \cdot 1 \cdot 2018, \quad 1 \cdot 2 \cdot 1009
$$

Thus, the empty fields can only be filled with one of the numbers 1, 2, 1009, and 2018. For easier expression, let's denote the unknown numbers in the empty fields as follows:

![](https://cdn.mathpix.com/cropped/2024_04_17_e836f4ee23919875e85ag-2.jpg?height=182&width=437&top_left_y=2005&top_left_x=815)

To satisfy $1 \cdot A \cdot B = A \cdot B \cdot C$, $C$ must be 1. To satisfy $A \cdot B \cdot C = B \cdot C \cdot 2$, $A$ must be 2. To satisfy $B \cdot C \cdot 2 = C \cdot 2 \cdot D$, $D$ must be $B$. Thus, we sequentially determine:

$$
1 = C = E, \quad A = 2 = F, \quad B = D = G \quad \text{etc.}
$$

The numbers in the fields therefore repeat according to the following pattern:

![](https://cdn.mathpix.com/cropped/2024_04_17_e836f4ee23919875e85ag-3.jpg?height=185&width=434&top_left_y=290&top_left_x=820)

To ensure that the product of any three consecutive fields is 2018, $B$ must be 1009. In the top row, the numbers 2, 1, 1009 therefore alternate regularly. Since $2019 = 3 \cdot 673$, the 2019th field is the third field in the 673rd triplet in the top row. Therefore, the number in this field is 1009.

Note. Once we know which numbers can appear in the fields, we can start filling them in one of the empty fields and then examine whether and how to proceed further. This way, we can rule out all possibilities except the one mentioned above. (For example, if we fill in $A = 1$, then from the requirement $1 \cdot A \cdot B = 2018$ it follows that $B = 2018$. To further satisfy $A \cdot B \cdot C = 2018$, $C$ must be 1, and thus $B \cdot C \cdot 2 = 2018 \cdot 1 \cdot 2$. This product is not 2018, so $A$ cannot be 1.)

A solution that does not clearly show why the above filling is the only possible one cannot be rated as the best.