The commander summoned the other defenders of the castle and decided how to divide their reward:

"The first will take one gold coin and a seventh of the remainder, the second will take two gold coins and a seventh of the new remainder, and so on. That is, the $n$-th defender will take $n$ gold coins and in addition a seventh of the remaining amount, until there are any left."

This way, all the gold coins were distributed, and all the defenders received the same amount.

How many defenders shared the reward?

(M. Volfová)
Let the number of defenders be $p$ and consider from the back. The last $p$-th defender took $p$ gold coins, and thus all the gold coins were taken. The second-to-last $(p-1)$-th defender took $p-1$ gold coins and a seventh of the current remainder, which we denote as $z$. Since both defenders received the same amount, we have

$$
p-1+\frac{1}{7} \cdot z=p
$$

From this, we get $\frac{1}{7} \cdot z=1$, hence $z=7$. At the same time, it follows that the last defender had $\mathrm{k}$ of the remaining six sevenths available. This means that

$$
p=\frac{6}{7} \cdot z
$$

thus $p=6$. If the defenders divided all the gold coins equally and each received the same amount, there must have been six defenders, each receiving six gold coins, so the total number of gold coins was $6 \cdot 6=36$. Since we have only considered some of the information from the problem so far, it is necessary to verify that such a division is indeed possible:

|  | took | remained |
| :---: | :---: | :---: |
| first | $1+\frac{1}{7}(36-1)=6$ | $36-6=30$ |
| second | $2+\frac{1}{7}(30-2)=6$ | $30-6=24$ |
| third | $3+\frac{1}{7}(24-3)=6$ | $24-6=18$ |
| fourth | $4+\frac{1}{7}(18-4)=6$ | $18-6=12$ |
| fifth | $5+\frac{1}{7}(12-5)=6$ | $12-6=6$ |
| sixth | $6+\frac{1}{7}(6-6)=6$ | $6-6=0$ |

The reward was divided among six defenders.

Suggested scoring. 3 points for the relationship (1) and determining $z=7$; 2 points for the relationship (2) and the result $p=6$; 1 point for verification.

Another solution. Let the total number of gold coins be $l$ and consider from the beginning. The first defender took one gold coin and a seventh of the remainder, so he took

$$
1+\frac{1}{7}(l-1)=\frac{1}{7}(l+6)
$$

gold coins, and the number of gold coins was reduced to $\frac{6}{7}(l-1)$. The second defender took two gold coins and a seventh of the new remainder, so he took

$$
2+\frac{1}{7}\left(\frac{6}{7}(l-1)-2\right)=\frac{1}{49}(6 l+78)
$$

gold coins. Since both defenders received the same amount, we have

$$
\frac{1}{7}(l+6)=\frac{1}{49}(6 l+78)
$$

From this, we get

$$
\begin{aligned}
7 l+42 & =6 l+78 \\
l & =36 .
\end{aligned}
$$

By expanding as in the table for the previous method, it can be verified that we have found a valid solution and that there were six defenders.

Suggested scoring. 1 point each for the relationships (3) and (4) and their possible simplification; 2 points for setting up and solving the equation (5); 2 points for verification and the result.

Another solution. Let the number of defenders be $p$. The last $p$-th defender took $p$ gold coins, and thus all the gold coins were taken. Since all defenders received the same amount, each received $p$ gold coins. The defenders therefore shared a total of $p^{2}$ gold coins.

The first defender took one gold coin and a seventh of the remainder, so

$$
1+\frac{1}{7}\left(p^{2}-1\right)=p
$$

thus

$$
p^{2}-1=7(p-1) \text {. }
$$

The left side of this equation can be expressed as $p^{2}-1=(p+1)(p-1)$. From the problem, it follows that $p>1$, so $p-1>0$ and the previous equation is equivalent to

$$
p+1=7 \text {, }
$$

thus $p=6$. By expanding as in the table for the first method, it can be verified that we have found a valid solution. The reward was divided among six defenders.

Suggested scoring. 2 points for expressing the total number of gold coins in terms of $p$; 3 points for setting up and solving the equation (6); 1 point for verification.

With the knowledge of the total number of gold coins, it can be determined by trial that the smallest $p$ for which the gold coins can be divided according to the given rules is $p=6$. Such a solution without justification that it is the only possibility should be rated no more than 4 points. Award an additional 2 points for the quality of the justification.

Another solution. Let the total number of gold coins be $l$. The first defender took one gold coin and a seventh of the remainder, so the remainder $l-1$ must be divisible by seven. The number $l$ is therefore of the form

$$
l=7 k+1
$$

for some positive integer $k$. The first defender thus took

$$
1+\frac{1}{7}(l-1)=1+k
$$

gold coins. Since all defenders received the same amount and the last one received exactly as many gold coins as his ordinal number, there were $k+1$ defenders, and each received $k+1$ gold coins, so they shared a total of

$$
l=(k+1)^{2}=k^{2}+2 k+1
$$

gold coins. By comparing (7) and (8), we get the equation

$$
7 k+1=k^{2}+2 k+1
$$

or $5 k=k^{2}$. From the problem, it follows that there were at least two defenders, so $k>0$ and the previous equation is equivalent to $k=5$. By expanding as in the table for the first method, it can be verified that we have found a valid solution. The reward was divided among six defenders.

Suggested scoring. 1 point for the relationship (7); 2 points for the relationship (8); 2 points for setting up and solving the equation (9); 1 point for verification.

With the knowledge (7), it can be determined by trial that the smallest $k$ for which the gold coins can be divided according to the given rules is $k=5$. Such a solution without justification that it is the only possibility should be rated no more than 4 points. Award an additional 2 points for the quality of the justification.