This is another example of an information puzzle. You are trying to find the most numbers a pair of spies can send to each other given that there are 26 stones in the river.
Furthermore, the stones are all identical, and the only way the spies can communicate is by throwing a certain number of stones into the pond at the same time.
You are ultimately trying to devise an algorithm that can produce the most possible outcomes for this procedure of throwing 26 stones, which will them map to the greatest number of results.
The answer lies in the number of ways there are to divide 26 stones into groups.
Although the stones themselves are identical, the order that they're thrown in isn't. So the groups that the stones are thrown in form an ordered partition, like such:
o o o o|o o o|o o|o o o o o|o|o o|o o o|o o o o|o o
Each o
represents a stone, and each |
represents a divider between a group of stones that were thrown. In the example above, there were 4, 3, 2, 5, 1, 2, 3, 4, 2 stones thrown.
Now, notice that any two consecutive stones can have a divider between them or not. This is a total of 25 dividers that can either be present or not present, for a total of $2^{25} = 33~554~432$ outcomes. So our first upper bound on the numbers the spies could exchange is $\lfloor2^{12.5}\rfloor = 5792$.
Complicating this is the fact that each spy has to have some control over the stones they throw. If spy 1 throws all 26 stones (which is the case with no dividers), this leaves no choice in the matter for spy 2.
So, we decide instead to give each spy his own set of 13 stones, which again can either have dividers between them or not (which is a total of 12 positions where dividers can occur). In this case, the upper bound is $2^{12} = 4096$.
Complicating this yet again is that each spy has to throw either the same number of groups of stones, or the first spy throws one more group of stones than the second spy.
So, for each of the 13 stones, the spies need to decide on a way to divide them into groups of, say, 6 or 7. If each spy decides beforehand to divide the stones into exactly 7 groups to throw, this gives a total of $\binom{12}{6} = 924$ choices in where to put the dividers, which is our first solution that actually works.
From here, we have to work up. Note that this first naïve solution doesn't take advantage of the fact that the first spy can throw one more group of stones than the second, or that either spy can throw less than 13 stones. So there's some information that we've ended up discarding.
The hockey stick theorem states that any number $\displaystyle \binom{n}{k}$ is equal to $\displaystyle \sum_{m=0}^{k} \binom{n-1-m}{k-m}$ (the theorem gets its name from the way those numbers form a hockey stick on Pascal's Triangle). So supposing we instead arrange that spy 2 can throw anywhere from 7 to 13 stones in 7 groups depending on how many spy 1 throws, he can still get a total of $\binom{13}{6} = 1716$ combinations. The algorithm then becomes:
Both spies determine which arrangement of stones to throw beforehand, with the restriction that they each throw exactly 7 groups of no more than 13 stones.
They come to the river and alternate throwing groups of stones that correspond to their number.
Spy 1 then throws all the remaining stones into the river, and they depart.
This allows them to exchange two numbers up to $1716$, which is the same number you got up to.
Now, we note that in some of the above cases, we have some stones left over that Spy 1 has to throw away. Could we put these to better use?
In $\binom{11}{5} = 462$ cases, a spy will have 1 stone left.
In $\binom{10}{4} = 210$ cases, a spy will have 2 stones left.
In $\binom{9}{3} = 84$ cases, a spy will have 3 stones left, etc.
In each of these cases, the spy can throw any number from $1$ to $n$ stones, but Spy 2 cannot throw any stones if Spy 1 doesn't throw at least $1$ first, so we consider the worst-case scenario where Spy 1 has thrown all his stones but Spy 2 still has $n$ to throw.
Spy 1 throws a stone, leaving $n-1$ for Spy 2. Spy 2 then throws any number from $1$ to $n-1$ and Spy 1 throws the rest away. This algorithm will still work if there are any other number of stones left.
This doesn't really do anything in the case where there are only 1 or 2 stones left (in each of these cases, Spy 2 either has no stones to throw or must throw exactly 1 stone, which doesn't give any information). However, for 3 or more stones, we get the following improvements:
For $s = 3$, we can express $2$ cases per arrangement, for an improvement of $\binom{9}{3} \times (2-1) = 84$ more cases.
For $s = 4$, we can express $3$ cases per arrangement, for an improvement of $\binom{8}{2} \times (3-1) = 56$ more cases.
For $s = 5$, we can express $4$ cases per arrangement, for an improvement of $\binom{7}{1} \times (4-1) = 21$ more cases.
For $s = 6$, we can express $5$ cases per arrangement, for an improvement of $\binom{6}{0} \times (5-1) = 4$ more cases.
All together, we get $84 + 56 + 21 + 4 = 145$ extra cases from the extra stones, bringing the total up to $1861$.
I can't see any elegant improvements to make on this algorithm past that, though. If you were to make a computer program to traverse all the possibilities, I suppose you could get to $2286$, but it would probably require a whole different approach, potentially involving the same sequence of throws from one spy representing different numbers depending on how the other spy threw his stones.