<s>[INST] Miscellaneous Olympiad Problem Two brothers sold a herd of sheep which they owned. for each sheep, they sold they received as many rubles as the number of sheep originally in the herd. The money was then divided in the following manner. First, the older brother took ten rubles followed by the younger brother taking ten and so on. At the end of the division, it was the younger brothers turn who found that there were fewer than ten rubles so he took what remained. The older brother to make the division fair gave the younger brother his penknife. 
We have to find the value of the penknife. 
The only thing I was able to determine is that the total money must be a two digit number so it can be represented as 10a+b, and the whole square( since each sheep was sold for the number of sheep originally in the herd) is 100a^2+20ab+b^2. 
However, I am not able to do much after this. Help would be much appreciated. 
 [/INST] If $N$ represents the total number of sheep that were originally in the flock, then the brothers were paid a total of $N^2$ rubles.  From the description of how the proceeds were divided, we know that if $N^2$ is divided by 20, the remainder will be between 10 and 19 (inclusive).  That is, there are nonnegative integers $q$ and $r$ such that
$$ N^2 = 20q + r
\qquad\text{and}\qquad
10 \le r \le 19. \tag{$\ast$}$$
While there are likely cleverer ways of approaching the problem at this point (the term "quadratic residues" comes to mind...), we can just brute force this problem: listing the remainders when square integers are divided by 20, we obtain
\begin{align}
1^2 &\equiv 1 \pmod{20} \\
2^2 &\equiv 4 \pmod{20} \\
3^2 &\equiv 9 \pmod{20} \\
4^2 &\equiv 16 \pmod{20} \\
5^2 &\equiv 5 \pmod{20} \\
6^2 &\equiv 16 \pmod{20} \\
7^2 &\equiv 9 \pmod{20} \\
8^2 &\equiv 4 \pmod{20} \\
9^2 &\equiv 1 \pmod{20} \\
10^2 &\equiv 0 \pmod{20} \\
11^2 &\equiv 1 \pmod{20} \\
12^2 &\equiv 4 \pmod{20} \\
13^2 &\equiv 9 \pmod{20} \\
14^2 &\equiv 16 \pmod{20} \\
15^2 &\equiv 5 \pmod{20} \\
16^2 &\equiv 16 \pmod{20} \\
17^2 &\equiv 9 \pmod{20} \\
18^2 &\equiv 4 \pmod{20} \\
19^2 &\equiv 1 \pmod{20} \\
20^2 &\equiv 0 \pmod{20},
\end{align}
at which point the pattern will repeat.  Note that there is exactly one term that satisfies our requirements:  16.  That is, if ($\ast$) holds, then $r=16$ is the only possibility.  Therefore there were 6 rubles left over when the process finished.
Hence in the last division, the younger brother took 6 rubles.  The older brother had just taken 10 rubles, which means that the older brother was up by 4.  To make things even, the older brother would have to give the younger brother 2 rubles (subtracting two from his own total, and adding two to the total of the younger brother, netting each brother 8 rubles in the last division), therefore the penknife must be worth two rubles.
</s>