\section*{Problem 5 - 031225}

Two shepherds sell a number of animals, each of which brings in as many groschen as the number of animals. They distribute the proceeds as follows:

The first shepherd receives 10 groschen, the second 10 groschen, then again the first 10 groschen, the second 10 groschen, and so on. After the first shepherd receives 10 groschen for the last time, a remainder remains that is less than 10 groschen.

With this remainder, they buy a knife.

How much does the knife cost?
}

The revenue for an animal is \(n\) groschen, thus \(n\) animals are sold and the shepherds receive a total of \(n^{2}\) groschen for their animals.

After each distribution round (the first shepherd receives 10 groschen, the second shepherd also receives 10 groschen), the remaining amount decreases by 20 groschen.

Thus, at the end, there are \(n^{2} \mod 20\) groschen left, from which the first shepherd receives another 10 groschen, leaving \(n^{2} \mod 20 - 10\) groschen, and it holds that

\[
0 < n^{2} \mod 20 - 10 < 10 \quad ; \quad 10 < n^{2} \mod 20 < 20
\]

Every natural number \(n\) can be represented as \(10a + b\) with \(a \in \mathbb{N}_{0}\) and \(b \in \mathbb{Z} \cap [-4, 5]\). Thus, we get

\[
n^{2} \mod 20 = (10a + b)^{2} \mod 20 = (100a^{2} + 20ab + b^{2}) \mod 20 = b^{2} \mod 20
\]

Since \((-b)^{2} = b^{2}\), we only test

\[
\begin{array}{rrl}
b=0: & 0 & \mod 20 = 0 \\
b=1: & 1 & \mod 20 = 1 \\
b=2: & 4 & \mod 20 = 4 \\
b=3: & 9 & \mod 20 = 9 \\
b=4: & 16 & \mod 20 = 16 \\
b=5: & 25 & \mod 20 = 5
\end{array}
\]

and we find that only \(|b| = 4\) satisfies the condition \(10 < n^{2} \mod 20 < 20\), and we conclude that the knife costs 6 groschen, regardless of how many animals were sold.