Determine the number of ways to write the numbers $1,2,3,4,5,6,7,8$ and 9 in the individual cells of the triangle in the picture so that the sum in each four-cell triangle is 23 and so that the given number is written in one of the cells in the direction of each arrow.

(E. Novotná)

![](https://cdn.mathpix.com/cropped/2024_04_17_27d0b340b16adf4cc1afg-1.jpg?height=409&width=483&top_left_y=635&top_left_x=792)
The sum of all the numbers written is $1+2+3+4+5+6+7+8+9=45$. In the figure, there are exactly three four-cell triangles, and the sum of the quadruples of numbers written in these triangles is $3 \cdot 23=69$. However, in this sum, the numbers on the gray cells are counted twice (each belongs to two four-cell triangles), while the other numbers are counted once. Therefore, the sum of the numbers on the three gray cells must be $69-45=24$.

![](https://cdn.mathpix.com/cropped/2024_04_17_27d0b340b16adf4cc1afg-1.jpg?height=408&width=483&top_left_y=1412&top_left_x=792)

Since the largest possible sum of three written numbers is $9+8+7=24$, the numbers 7, 8, and 9 must be in the gray cells. From the problem statement, we know that 7 must be in the bottom row, so the numbers 8 and 9 must be in the outer cells of the second row.

![](https://cdn.mathpix.com/cropped/2024_04_17_27d0b340b16adf4cc1afg-1.jpg?height=405&width=485&top_left_y=2065&top_left_x=794)

The number 2 then has only one free spot, as shown in the figure. In the top four-cell triangle, only one number is missing, which we can now fill in: $23-8-9-2=4$.

![](https://cdn.mathpix.com/cropped/2024_04_17_27d0b340b16adf4cc1afg-2.jpg?height=402&width=483&top_left_y=176&top_left_x=792)

The number 6 must be in one of the gray cells in the previous figure, so it belongs to the left four-cell triangle. If this triangle contained the number 8, the last free cell would contain the number $23-8-7-6=2$, which is not possible (2 is already placed in the second row). Therefore, the left four-cell triangle has the number 9 in its top cell, and in the last unoccupied cell, it is $23-9-7-6=1$. Thus, the numbers in the gray cells are 1 and 6, which can be placed in two ways.

In the unoccupied spots in the right four-cell triangle, only the numbers 3 and 5 can be placed; the sum in this triangle is indeed $8+7+3+5=23$. The numbers 3 and 5 can be filled in two ways. Therefore, the problem has a total of $2 \cdot 2=4$ solutions:
![](https://cdn.mathpix.com/cropped/2024_04_17_27d0b340b16adf4cc1afg-2.jpg?height=332&width=1578&top_left_y=1116&top_left_x=246)

Grading. 3 points for explaining where the numbers 7, 8, and 9 are located; 1 point for filling in the numbers 2 and 4; 1 point for filling in the numbers 6 and 1; 1 point for the correct number of solutions.

If the solver finds one correct solution randomly (without a gradable explanation), award 1 point; for two solutions, 2 points; for three and four solutions, 3 points.